This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove cruft from basic_string::_Rep


Hi,

this an harmeless "intermezzo" in my joint work with Loren aimed at improving basic_string
memory allocation. In this case we have just removed some dead code and (rather
misleading) comments.

The patch (bootstrapped and tested i686-pc-linux-gnu) was already approved by Benjamin.

It would be nice if it could find its way in the repository ASAP, since we are planning of
submitting another substantive step (the exponential shaping part, indeed) in 2-3 days
from now.

Cheers,
Paolo.

///////////////

Paolo Carlini <pcarlini@unitus.it>
Loren J. Rittle <ljrittle@acm.org>

        * include/bits/basic_string.h (basic_string::_Rep::__default_excess,
        _S_excess_slop): Unused, remove.
        * include/bits/basic_string.tcc: Remove dead code.
        * include/bits/c++config: Remove comment.

diff -urN gcc-vanilla/libstdc++-v3/include/bits/basic_string.h
gcc/libstdc++-v3/include/bits/basic_string.h
--- gcc-vanilla/libstdc++-v3/include/bits/basic_string.h Fri Nov  2 18:38:10 2001
+++ gcc/libstdc++-v3/include/bits/basic_string.h Wed Nov 28 13:43:37 2001
@@ -196,22 +196,6 @@

  _CharT*
  _M_clone(const _Alloc&, size_type __res = 0);
-
-#if _GLIBCPP_ALLOC_CONTROL
- // These function pointers allow you to modify the allocation
- // policy used by the string classes.  By default they expand by
- // powers of two, but this may be excessive for space-critical
- // applications.
-
- // Returns true if ALLOCATED is too much larger than LENGTH
- static bool (*_S_excess_slop) (size_t __length, size_t __allocated);
-
- inline static bool
- __default_excess(size_t, size_t);
-#else
- inline static bool
- _S_excess_slop(size_t, size_t);
-#endif
       };

       // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
diff -urN gcc-vanilla/libstdc++-v3/include/bits/basic_string.tcc
gcc/libstdc++-v3/include/bits/basic_string.tcc
--- gcc-vanilla/libstdc++-v3/include/bits/basic_string.tcc Wed Nov 28 12:57:16 2001
+++ gcc/libstdc++-v3/include/bits/basic_string.tcc Wed Nov 28 13:42:27 2001
@@ -349,13 +349,6 @@
  }
     }

-#ifdef _GLIBCPP_ALLOC_CONTROL
-  template<typename _CharT, typename _Traits, typename _Alloc>
-    bool (*basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_excess_slop)
-    (size_t, size_t) =
-    basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_default_excess;
-#endif
-
   template<typename _CharT, typename _Traits, typename _Alloc>
     typename basic_string<_CharT, _Traits, _Alloc>::_Rep*
     basic_string<_CharT, _Traits, _Alloc>::_Rep::
@@ -450,19 +443,6 @@
  }
       __r->_M_length = _M_length;
       return __r->_M_refdata();
-    }
-
-  template<typename _CharT, typename _Traits, typename _Alloc>
-  inline bool
-#ifdef _GLIBCPP_ALLOC_CONTROL
-    basic_string<_CharT, _Traits, _Alloc>::_Rep::
-    _S_default_excess(size_t __s, size_t __r)
-#else
-    basic_string<_CharT, _Traits, _Alloc>::_Rep::
-    _S_excess_slop(size_t __s, size_t __r)
-#endif
-    {
-      return 2 * (__s <= 16 ? 16 : __s) < __r;
     }

   template<typename _CharT, typename _Traits, typename _Alloc>
diff -urN gcc-vanilla/libstdc++-v3/include/bits/c++config
gcc/libstdc++-v3/include/bits/c++config
--- gcc-vanilla/libstdc++-v3/include/bits/c++config Wed Nov 28 12:57:16 2001
+++ gcc/libstdc++-v3/include/bits/c++config Wed Nov 28 13:44:29 2001
@@ -55,10 +55,6 @@
 // Use corrected code from the committee library group's issues list.
 #define _GLIBCPP_RESOLVE_LIB_DEFECTS 1

-// Define this to permit user-level control of the expansion of string
-// buffers (via a fn pointer), see basic_string.* for more.
-//#define _GLIBCPP_ALLOC_CONTROL
-
 // Map gthr.h abstraction to that required for STL.  Do not key off of
 // __GTHREADS at this point since we haven't seen the correct symbol
 // yet, instead setup so that include/bits/stl_threads.h will know to






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]