Blame SOURCES/compat-libstdc++33++-fully-dynamic-strings.patch

727081
2004-10-28  Paolo Carlini  <pcarlini@suse.de>
727081
727081
	PR libstdc++/16612
727081
	* include/bits/basic_string.h (basic_string()): When
727081
	_GLIBCXX_FULLY_DYNAMIC_STRING is defined, don't deal with _S_empty_rep.
727081
	* include/bits/basic_string.tcc (_S_construct): Likewise.
727081
727081
--- libstdc++33-v3/include/bits/basic_string.tcc.jj	2002-11-09 18:42:55.000000000 +0100
727081
+++ libstdc++33-v3/include/bits/basic_string.tcc	2004-11-12 14:17:19.946131774 +0100
727081
@@ -77,8 +77,10 @@ namespace std
727081
       _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a,
727081
 		   input_iterator_tag)
727081
       {
727081
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
727081
 	if (__beg == __end && __a == _Alloc())
727081
 	  return _S_empty_rep()._M_refcopy();
727081
+#endif
727081
 	// Avoid reallocation for common case.
727081
 	_CharT __buf[100];
727081
 	size_type __i = 0;
727081
@@ -137,11 +139,13 @@ namespace std
727081
       _S_construct(_InIter __beg, _InIter __end, const _Alloc& __a, 
727081
 		   forward_iterator_tag)
727081
       {
727081
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
727081
 	if (__beg == __end && __a == _Alloc())
727081
 	  return _S_empty_rep()._M_refcopy();
727081
+#endif
727081
 
727081
 	// NB: Not required, but considered best practice.
727081
-	if (__builtin_expect(__beg == _InIter(), 0))
727081
+	if (__builtin_expect(__beg == _InIter() && __beg != __end, 0))
727081
 	  __throw_logic_error("attempt to create string with null pointer");
727081
 
727081
 	size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));
727081
@@ -166,8 +170,10 @@ namespace std
727081
     basic_string<_CharT, _Traits, _Alloc>::
727081
     _S_construct(size_type __n, _CharT __c, const _Alloc& __a)
727081
     {
727081
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
727081
       if (__n == 0 && __a == _Alloc())
727081
 	return _S_empty_rep()._M_refcopy();
727081
+#endif
727081
 
727081
       // Check for out_of_range and length_error exceptions.
727081
       _Rep* __r = _Rep::_S_create(__n, __a);
727081
--- libstdc++33-v3/include/bits/basic_string.h.jj	2002-05-22 15:39:29.000000000 +0200
727081
+++ libstdc++33-v3/include/bits/basic_string.h	2004-11-12 14:14:42.831975711 +0100
727081
@@ -923,7 +923,11 @@ namespace std
727081
   template<typename _CharT, typename _Traits, typename _Alloc>
727081
     inline basic_string<_CharT, _Traits, _Alloc>::
727081
     basic_string()
727081
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
727081
     : _M_dataplus(_S_empty_rep()._M_refcopy(), _Alloc()) { }
727081
+#else
727081
+    : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }
727081
+#endif
727081
 
727081
   // operator+
727081
   template<typename _CharT, typename _Traits, typename _Alloc>