std_sstream.h (basic_stringbuf::str(const __string_type&)): Prefer data() to c_str() thus avoiding assigning the unnecessary NULL-terminator.

2002-11-05  Jonathan Wakely  <cow@compsoc.man.ac.uk>

	* include/std/std_sstream.h
	(basic_stringbuf::str(const __string_type&)):
	Prefer data() to c_str() thus avoiding assigning the
	unnecessary NULL-terminator.

From-SVN: r58844
This commit is contained in:
Jonathan Wakely 2002-11-06 00:05:35 +00:00 committed by Paolo Carlini
parent c034b45358
commit 93d87ec6f8
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2002-11-05 Jonathan Wakely <cow@compsoc.man.ac.uk>
* include/std/std_sstream.h
(basic_stringbuf::str(const __string_type&)):
Prefer data() to c_str(), thus avoiding assigning the
unnecessary NULL-terminator.
2002-11-05 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/8258

View File

@ -106,7 +106,7 @@ namespace std
str(const __string_type& __s)
{
// Cannot use _M_string = __s, since v3 strings are COW.
_M_string.assign(__s.c_str(), __s.size());
_M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode);
}