]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed default-length parameter from some SBuf functions
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 6 Feb 2015 16:53:38 +0000 (17:53 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 6 Feb 2015 16:53:38 +0000 (17:53 +0100)
src/SBuf.h

index 7434726126cf5a258dfd7726695d8c8372b950e2..58af282be84e1e3355eae371afbdeb79b5cb7eaa 100644 (file)
@@ -146,7 +146,8 @@ public:
      * \note it is the caller's responsibility not to go out of bounds
      * \note bounds is 0 <= pos < length(); caller must pay attention to signedness
      */
-    explicit SBuf(const char *S, size_type n = npos);
+    explicit SBuf(const char *S, size_type n);
+    explicit SBuf(const char *S) : SBuf(S,strlen(S)) {}
 
     /** Constructor: import SquidString, copying contents.
      *
@@ -181,7 +182,8 @@ public:
      * \note to assign a std::string use the pattern:
      *    assign(stdstr.data(), stdstd.length())
      */
-    SBuf& assign(const char *S, size_type n = npos);
+    SBuf& assign(const char *S, size_type n);
+    SBuf& assign(const char *S) {return assign(S,strlen(S));}
 
     /** Assignment operator. Copy a NULL-terminated c-style string into a SBuf.
      *
@@ -218,7 +220,8 @@ public:
      * \note to append a std::string use the pattern
      *     cstr_append(stdstr.data(), stdstd.length())
      */
-    SBuf& append(const char * S, size_type Ssize = npos);
+    SBuf& append(const char * S, size_type Ssize);
+    SBuf& append(const char * S) { return append(S,strlen(S)); }
 
     /** Assignment operation with printf(3)-style definition
      * \note arguments may be evaluated more than once, be careful
@@ -279,30 +282,48 @@ public:
      * \retval <0 argument of the call is smaller than called SBuf
      * \retval 0  argument of the call has the same contents of called SBuf
      */
-    int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const;
+    int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n) const;
+    int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive) const {
+        return compare(S, isCaseSensitive, S.length());
+    }
 
     /// shorthand version for compare()
-    inline int cmp(const SBuf &S, const size_type n = npos) const {
+    inline int cmp(const SBuf &S, const size_type n) const {
         return compare(S,caseSensitive,n);
     }
+    inline int cmp(const SBuf &S) const {
+        return compare(S,caseSensitive,S.length());
+    }
 
     /// shorthand version for case-insensitive compare()
-    inline int caseCmp(const SBuf &S, const size_type n = npos) const {
+    inline int caseCmp(const SBuf &S, const size_type n) const {
         return compare(S,caseInsensitive,n);
     }
+    inline int caseCmp(const SBuf &S) const {
+        return compare(S,caseInsensitive,S.length());
+    }
 
     /// Comparison with a C-string.
-    int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const;
+    int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n) const;
+    int compare(const char *s, const SBufCaseSensitive isCaseSensitive) const {
+        return compare(s,isCaseSensitive,strlen(s));
+    }
 
     /// Shorthand version for C-string compare().
-    inline int cmp(const char *S, const size_type n = npos) const {
+    inline int cmp(const char *S, const size_type n) const {
         return compare(S,caseSensitive,n);
     }
+    inline int cmp(const char *S) const {
+        return compare(S,caseSensitive,strlen(S));
+    }
 
     /// Shorthand version for case-insensitive C-string compare().
-    inline int caseCmp(const char *S, const size_type n = npos) const {
+    inline int caseCmp(const char *S, const size_type n) const {
         return compare(S,caseInsensitive,n);
     }
+    inline int caseCmp(const char *S) const {
+        return compare(S,caseInsensitive,strlen(S));
+    }
 
     /** check whether the entire supplied argument is a prefix of the SBuf.
      *  \param S the prefix to match against