=== modified file 'src/SBuf.cc' --- src/SBuf.cc 2010-09-14 21:53:55 +0000 +++ src/SBuf.cc 2010-09-17 07:09:19 +0000 @@ -431,18 +431,6 @@ return stats; } -void SBuf::terminate() -{ - if (!store_->canAppend(bufEnd(),1)) { - grow(length()+1); - ++stats.sset; - } else { - ++stats.qset; - } - *(bufEnd())='\0'; - ++store_->bufUsed; //hand-appending, without recording the increased SBuf length. -} - SBuf& SBuf::absorb(char * cstr, SBuf::size_type len) { assign(cstr,len); @@ -485,7 +473,15 @@ char *SBuf::exportTRef() { - terminate(); + if (!store_->canAppend(bufEnd(),1)) { + grow(length()+1); + ++stats.sset; + } else { + ++stats.qset; + } + *(bufEnd())='\0'; + ++store_->bufUsed; //hand-appending, without recording the increased SBuf length. + return buf(); } @@ -664,8 +660,7 @@ va_list arg; int rv; va_start (arg, format); - terminate(); - rv = vsscanf(buf(),format,arg); + rv = vsscanf(exportTRef(),format,arg); va_end(arg); return rv; } === modified file 'src/SBuf.h' --- src/SBuf.h 2010-09-10 06:43:54 +0000 +++ src/SBuf.h 2010-09-17 07:09:48 +0000 @@ -59,7 +59,7 @@ * \note read operations and compares are NOT counted. */ class SBufStats { - public: +public: u_int64_t alloc; ///number of allocation operations u_int64_t live; ///number of free operations u_int64_t qset; ///number of assigns/appends without content copy @@ -88,7 +88,7 @@ * moots the whole point of using refcounted buffers in the first place. */ class SBuf { - public: +public: typedef signed int size_type; static const size_type npos = -1; @@ -306,13 +306,6 @@ */ static const SBufStats& getStats(); - /** Null-terminate the SBuf - * - * Make sure that the first byte AFTER the SBuf is a NULL. - * Doesn't alter the SBuf contents, may trigger a backing store reloaction - */ - void terminate(); - /** Import a c-style string into the memory-managed world * * The char* MUST have been dynamically allocated via new,