From: Amos Jeffries Date: Sat, 7 Feb 2015 04:41:45 +0000 (-0800) Subject: Revert rev.13916 X-Git-Tag: merge-candidate-3-v1~277 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc1f03ae6b4ac2a8ec055f468b9fee0a79c95195;p=thirdparty%2Fsquid.git Revert rev.13916 --- diff --git a/src/SBuf.cc b/src/SBuf.cc index 0aa9801e04..1468192835 100644 --- a/src/SBuf.cc +++ b/src/SBuf.cc @@ -208,8 +208,10 @@ SBuf::append(const SBuf &S) SBuf & SBuf::append(const char * S, size_type Ssize) { - if (!S) + if (S == NULL) return *this; + if (Ssize == SBuf::npos) + Ssize = strlen(S); debugs(24, 7, "from c-string to id " << id); // coverity[access_dbuff_in_call] return lowAppend(S, Ssize); diff --git a/src/SBuf.h b/src/SBuf.h index 7a0a0e9a25..7434726126 100644 --- a/src/SBuf.h +++ b/src/SBuf.h @@ -212,19 +212,13 @@ public: * as needed. * * \param S the c string to be copied. Can be NULL. - * \param Ssize how many bytes to import into the SBuf. - * If S is NULL, Ssize is ignored. + * \param Ssize how many bytes to import into the SBuf. If it is npos + * or unspecified, imports to end-of-cstring. If S is NULL, + * Ssize is ignored. * \note to append a std::string use the pattern * cstr_append(stdstr.data(), stdstd.length()) */ - SBuf& append(const char * S, size_type Ssize); - - /// \see SBuf& append(const char * S, size_type Ssize) - SBuf& append(const char * S) { - if (!S) - return *this; - return append(S, strlen(S)); - } + SBuf& append(const char * S, size_type Ssize = npos); /** Assignment operation with printf(3)-style definition * \note arguments may be evaluated more than once, be careful