]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert rev.13916
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 7 Feb 2015 04:41:45 +0000 (20:41 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 7 Feb 2015 04:41:45 +0000 (20:41 -0800)
src/SBuf.cc
src/SBuf.h

index 0aa9801e04f660a874c329ed391d534ad4ba130d..146819283543f41bc8b57c8c1a3424360952db3f 100644 (file)
@@ -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);
index 7a0a0e9a252f66604ea5f3da92033296c7629ef6..7434726126cf5a258dfd7726695d8c8372b950e2 100644 (file)
@@ -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