diff options
author | Jonathan Wakely <redi@gcc.gnu.org> | 2004-08-07 16:31:50 +0100 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2004-08-07 15:31:50 +0000 |
commit | 8844a2f541582d58075af46362d57a1f75fc6eff (patch) | |
tree | a2886ad0c5be67cb4ec7ff98c3e88bd6529a3b19 /libstdc++-v3/src/debug.cc | |
parent | 49864a8255efafcce754540709efe5b4e28eea7b (diff) | |
download | gcc-8844a2f541582d58075af46362d57a1f75fc6eff.tar.gz |
debug.cc (_Error_formatter::_M_print_string): In order to print individual words from __string...
2004-08-07 Jonathan Wakely <redi@gcc.gnu.org>
Paolo Carlini <pcarlini@suse.de>
* src/debug.cc (_Error_formatter::_M_print_string): In order
to print individual words from __string, _M_format_word can't
be called since may be just sprintf, thus ignoring completely
__n: instead, use memmove and append '\0' by hand.
Co-Authored-By: Paolo Carlini <pcarlini@suse.de>
From-SVN: r85670
Diffstat (limited to 'libstdc++-v3/src/debug.cc')
-rw-r--r-- | libstdc++-v3/src/debug.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libstdc++-v3/src/debug.cc b/libstdc++-v3/src/debug.cc index 05ebc2ffa7b..20295fb2898 100644 --- a/libstdc++-v3/src/debug.cc +++ b/libstdc++-v3/src/debug.cc @@ -569,12 +569,17 @@ namespace __gnu_debug { // [__start, __end) denotes the next word __end = __start; - while (isalnum(*__end)) ++__end; - if (__start == __end) ++__end; - if (isspace(*__end)) ++__end; + while (isalnum(*__end)) + ++__end; + if (__start == __end) + ++__end; + if (isspace(*__end)) + ++__end; - assert(__end - __start + 1< __bufsize); - _M_format_word(__buf, __end - __start + 1, "%s", __start); + const ptrdiff_t __len = __end - __start; + assert(__len < __bufsize); + memmove(__buf, __start, __len); + __buf[__len] = '\0'; _M_print_word(__buf); __start = __end; |