basic_string.tcc (_Rep::_S_create): Minor tweak.

2004-01-31  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/basic_string.tcc (_Rep::_S_create): Minor tweak.

From-SVN: r77035
This commit is contained in:
Paolo Carlini 2004-01-31 15:39:52 +00:00 committed by Paolo Carlini
parent 4500e76d5e
commit 24f330691d
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2004-01-31 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.tcc (_Rep::_S_create): Minor tweak.
2004-01-30 Paolo Carlini <pcarlini@suse.de>
* testsuite/21_strings/basic_string/cons/char/6.cc: New.

View File

@ -514,11 +514,10 @@ namespace std
// Whew. Seemingly so needy, yet so elemental.
size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
if (__size + __malloc_header_size > __pagesize)
const size_type __adj_size = __size + __malloc_header_size;
if (__adj_size > __pagesize)
{
const size_type __extra = (__pagesize
- (__size + __malloc_header_size)
% __pagesize);
const size_type __extra = __pagesize - __adj_size % __pagesize;
__capacity += __extra / sizeof(_CharT);
// Never allocate a string bigger than _S_max_size.
if (__capacity > _S_max_size)
@ -527,9 +526,7 @@ namespace std
}
else if (__size > __subpagesize)
{
const size_type __extra = (__subpagesize
- (__size + __malloc_header_size)
% __subpagesize);
const size_type __extra = __subpagesize - __adj_size % __subpagesize;
__capacity += __extra / sizeof(_CharT);
__size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
}