aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-11-26 07:19:11 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-11-26 02:19:11 -0500
commitf4f3e8fdf7440699c7f266b399fd8159ee43d223 (patch)
tree85d965149086f3ac6e9f3f524177fc78b28e79f2
parent11df6ae76778ef3d3ed790ec8f605f59e2a9aaa4 (diff)
downloadgcc-f4f3e8fdf7440699c7f266b399fd8159ee43d223.zip
gcc-f4f3e8fdf7440699c7f266b399fd8159ee43d223.tar.gz
gcc-f4f3e8fdf7440699c7f266b399fd8159ee43d223.tar.bz2
London changes to string:
* std/bastring.cc (check_realloc): Don't be selfish anymore. * std/bastring.h (non-const operator[]): Be selfish. (iterator forms of insert and erase): Stay selfish. From-SVN: r16722
-rw-r--r--libstdc++/ChangeLog7
-rw-r--r--libstdc++/Makefile.in14
-rw-r--r--libstdc++/std/bastring.cc1
-rw-r--r--libstdc++/std/bastring.h10
4 files changed, 21 insertions, 11 deletions
diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog
index 7d2ce3a..7830adc 100644
--- a/libstdc++/ChangeLog
+++ b/libstdc++/ChangeLog
@@ -1,3 +1,10 @@
+Tue Nov 25 23:16:44 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ London changes to string:
+ * std/bastring.cc (check_realloc): Don't be selfish anymore.
+ * std/bastring.h (non-const operator[]): Be selfish.
+ (iterator forms of insert and erase): Stay selfish.
+
Tue Nov 25 14:03:43 1997 H.J. Lu (hjl@gnu.org)
* Makefile.in (stmp-complex, bigstmp-complex): Changed to
diff --git a/libstdc++/Makefile.in b/libstdc++/Makefile.in
index 1120874..48a470c 100644
--- a/libstdc++/Makefile.in
+++ b/libstdc++/Makefile.in
@@ -301,9 +301,10 @@ stuff:
$(MAKE) clean
$(MAKE) -C ../libio c++clean
$(MAKE) -C ../libg++ clean
- $(MAKE) $(MAKEFLAGS) check
- $(MAKE) -C ../libio check
- $(MAKE) -C ../libg++ check
+ -$(MAKE) $(MAKEFLAGS) check
+ -$(MAKE) -C ../libio check
+ -$(MAKE) -C ../libg++ check
+ -$(MAKE) -C ../gcc check-g++
stuff1:
$(MAKE) clean
@@ -311,6 +312,7 @@ stuff1:
$(MAKE) -C ../libg++ clean
stuff2:
- $(MAKE) check
- $(MAKE) -C ../libio check
- $(MAKE) -C ../libg++ check
+ -$(MAKE) check
+ -$(MAKE) -C ../libio check
+ -$(MAKE) -C ../libg++ check
+ -$(MAKE) -C ../gcc check-g++
diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc
index aa151da..4447970 100644
--- a/libstdc++/std/bastring.cc
+++ b/libstdc++/std/bastring.cc
@@ -87,6 +87,7 @@ inline bool basic_string <charT, traits>::
check_realloc (size_t s) const
{
s += sizeof (charT);
+ rep ()->selfish = false;
return (rep ()->ref > 1
|| s > capacity ()
|| Rep::excess_slop (s, capacity ()));
diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h
index 59a5995..f8fe279 100644
--- a/libstdc++/std/bastring.h
+++ b/libstdc++/std/bastring.h
@@ -220,9 +220,9 @@ public:
basic_string& insert (size_type pos, size_type n, charT c)
{ return replace (pos, 0, n, c); }
iterator insert(iterator p, charT c)
- { insert (p - ibegin (), 1, c); return p; }
+ { insert (p - ibegin (), 1, c); selfish (); return p; }
iterator insert(iterator p, size_type n, charT c)
- { insert (p - ibegin (), n, c); return p; }
+ { insert (p - ibegin (), n, c); selfish (); return p; }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last)
@@ -234,9 +234,9 @@ public:
basic_string& erase (size_type pos = 0, size_type n = npos)
{ return replace (pos, n, (size_type)0, (charT)0); }
iterator erase(iterator p)
- { replace (p - ibegin (), 1, (size_type)0, (charT)0); return p; }
+ { replace (p-ibegin (), 1, (size_type)0, (charT)0); selfish (); return p; }
iterator erase(iterator f, iterator l)
- { replace (f - ibegin (), l - f, (size_type)0, (charT)0); return f; }
+ { replace (f-ibegin (), l-f, (size_type)0, (charT)0);selfish ();return f; }
basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
size_type pos2 = 0, size_type n2 = npos);
@@ -278,7 +278,7 @@ public:
}
reference operator[] (size_type pos)
- { unique (); return (*rep ())[pos]; }
+ { selfish (); return (*rep ())[pos]; }
reference at (size_type pos)
{