summaryrefslogtreecommitdiff
path: root/libstdc++
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-11 22:41:38 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-11 22:41:38 +0000
commit1ef33a5e946899dadcabd97bdfc0af1acfa9d88e (patch)
treea60805c840ee94f03189163f278c237b8628e4cf /libstdc++
parent3414548c6ce8d9f2cbb2a951afdcd3f1cf6f2e44 (diff)
downloadgcc-1ef33a5e946899dadcabd97bdfc0af1acfa9d88e.tar.gz
* std/straits.h (is_del): Boolify with !!.
* std/bastring.cc (compare to charT*): Add rlen==n check. * std/bastring.h (Rep::grab): Add x86 atomic version. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35647 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++')
-rw-r--r--libstdc++/ChangeLog9
-rw-r--r--libstdc++/std/bastring.cc4
-rw-r--r--libstdc++/std/bastring.h11
-rw-r--r--libstdc++/std/straits.h6
4 files changed, 24 insertions, 6 deletions
diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog
index 010a805f24c..ba4a27385e5 100644
--- a/libstdc++/ChangeLog
+++ b/libstdc++/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-11 Jason Merrill <jason@redhat.com>
+
+ * std/straits.h (is_del): Boolify with !!.
+
+2000-08-11 "Axel Habermann" <Axel.Habermann@xtradyne.de>
+
+ * std/bastring.cc (compare to charT*): Add rlen==n check.
+ * std/bastring.h (Rep::grab): Add x86 atomic version.
+
2000-8-4 David E O'Brien <obrien@FreeBSD.org>
* std/mask_array.h (mask_array): Rename template type
diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc
index f86f6d30157..b8fec4fa7db 100644
--- a/libstdc++/std/bastring.cc
+++ b/libstdc++/std/bastring.cc
@@ -1,5 +1,5 @@
// Member templates for the -*- C++ -*- string classes.
-// Copyright (C) 1994, 1999 Free Software Foundation
+// Copyright (C) 1994, 1999, 2000 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -423,6 +423,8 @@ compare (const charT* s, size_type pos, size_type n) const
int r = traits::compare (data () + pos, s, rlen);
if (r != 0)
return r;
+ if (rlen == n)
+ return 0;
return (length () - pos) - n;
}
diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h
index c45607a0410..5551ec1fe47 100644
--- a/libstdc++/std/bastring.h
+++ b/libstdc++/std/bastring.h
@@ -72,9 +72,14 @@ private:
charT* data () { return reinterpret_cast<charT *>(this + 1); }
charT& operator[] (size_t s) { return data () [s]; }
- charT* grab () { if (selfish) return clone (); ++ref; return data (); }
#if defined __i486__ || defined __i586__ || defined __i686__
- void release ()
+ charT* grab () { if (selfish) return clone ();
+ asm ("lock; addl %0, (%1)"
+ : : "a" (1), "d" (&ref)
+ : "memory");
+ return data (); }
+
+ void release ()
{
size_t __val;
// This opcode exists as a .byte instead of as a mnemonic for the
@@ -90,6 +95,7 @@ private:
delete this;
}
#elif defined __sparc_v9__
+ charT* grab () { if (selfish) return clone (); ++ref; return data (); }
void release ()
{
size_t __newval, __oldval = ref;
@@ -111,6 +117,7 @@ private:
delete this;
}
#else
+ charT* grab () { if (selfish) return clone (); ++ref; return data (); }
void release () { if (--ref == 0) delete this; }
#endif
diff --git a/libstdc++/std/straits.h b/libstdc++/std/straits.h
index c80e7ab7a68..eada4fc4d85 100644
--- a/libstdc++/std/straits.h
+++ b/libstdc++/std/straits.h
@@ -1,5 +1,5 @@
// Character traits template for the -*- C++ -*- string classes.
-// Copyright (C) 1994 Free Software Foundation
+// Copyright (C) 1994, 2000 Free Software Foundation
// This file is part of the GNU ANSI C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -117,7 +117,7 @@ struct string_char_traits <char> {
static bool lt (const char_type& c1, const char_type& c2)
{ return (c1 < c2); }
static char_type eos () { return 0; }
- static bool is_del(char_type a) { return isspace(a); }
+ static bool is_del(char_type a) { return !!isspace(a); }
static int compare (const char_type* s1, const char_type* s2, size_t n)
{ return memcmp (s1, s2, n); }
@@ -145,7 +145,7 @@ struct string_char_traits <wchar_t> {
static bool lt (const char_type& c1, const char_type& c2)
{ return (c1 < c2); }
static char_type eos () { return 0; }
- static bool is_del(char_type a) { return iswspace(a); }
+ static bool is_del(char_type a) { return !!iswspace(a); }
static int compare (const char_type* s1, const char_type* s2, size_t n)
{ return wmemcmp (s1, s2, n); }