]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Drop String::undefined()
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 31 Oct 2013 19:13:17 +0000 (13:13 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 31 Oct 2013 19:13:17 +0000 (13:13 -0600)
It appears that all code using String::undefined() for boolean tests can
remain logically consistent using checks on string size() instead.
This helps by removing part of the
undefined-empty/defined-empty/0-length-empty string state
differentiation.

src/HttpHdrSc.cc
src/HttpReply.cc
src/acl/HttpHeaderData.cc
src/acl/NoteData.cc
src/ftp.cc
src/http.cc
src/store_log.cc

index 52dc243046fe25a9789fda899cca6f5d324d04b2..523fe772fd0bf2e53d98b3a49be5522cadb930bd 100644 (file)
@@ -364,9 +364,9 @@ HttpHdrSc::findTarget(const char *target)
     while (node) {
         HttpHdrScTarget *sct = (HttpHdrScTarget *)node->data;
 
-        if (target && sct->target.defined() && !strcmp (target, sct->target.termedBuf()))
+        if (target && sct->target.size() > 0 && !strcmp(target, sct->target.termedBuf()))
             return sct;
-        else if (!target && sct->target.undefined())
+        else if (!target && sct->target.size() == 0)
             return sct;
 
         node = node->next;
index fffa869c60bd8d5fae8069f36f9dea00f0256fe7..a7df80b8a9ac5ef8c8d88fb56e610cf4686edd78 100644 (file)
@@ -270,7 +270,7 @@ HttpReply::validatorsMatch(HttpReply const * otherRep) const
 
     two = otherRep->header.getStrOrList(HDR_ETAG);
 
-    if (one.undefined() || two.undefined() || one.caseCmp(two)!=0 ) {
+    if (one.size()==0 || two.size()==0 || one.caseCmp(two)!=0 ) {
         one.clean();
         two.clean();
         return 0;
@@ -284,7 +284,7 @@ HttpReply::validatorsMatch(HttpReply const * otherRep) const
 
     two = otherRep->header.getStrOrList(HDR_CONTENT_MD5);
 
-    if (one.undefined() || two.undefined() || one.caseCmp(two) != 0 ) {
+    if (one.size()==0 || two.size()==0 || one.caseCmp(two)!=0 ) {
         one.clean();
         two.clean();
         return 0;
index 56e1632aff8a5e766dd043ed6e3f7f42b1089f6c..580ade10ff1a4f2378e610c43d7c2a3aae74e707 100644 (file)
@@ -108,7 +108,7 @@ ACLHTTPHeaderData::parse()
 bool
 ACLHTTPHeaderData::empty() const
 {
-    return (hdrId == HDR_BAD_HDR && hdrName.undefined()) || regex_rule->empty();
+    return (hdrId == HDR_BAD_HDR && hdrName.size()==0) || regex_rule->empty();
 }
 
 ACLData<HttpHeader*> *
index 3195971ee31f4afce8f045e00759609466852a39..ab4e4cfb67197083e0e1ca32dff4b7ba51762377 100644 (file)
@@ -74,7 +74,7 @@ ACLNoteData::parse()
 bool
 ACLNoteData::empty() const
 {
-    return name.undefined();
+    return name.size() == 0;
 }
 
 ACLData<HttpRequest *> *
index fb320b0664587d1e243e353174d1b922c704f377..f4b108080936ff6056e3a9ec42bd5e8ed6af10a6 100644 (file)
@@ -1419,7 +1419,7 @@ FtpStateData::checkUrlpath()
     int l;
     size_t t;
 
-    if (str_type_eq.undefined()) //hack. String doesn't support global-static
+    if (str_type_eq.size()==0) //hack. String doesn't support global-static
         str_type_eq="type=";
 
     if ((t = request->urlpath.rfind(';')) != String::npos) {
index 9a8f6ddf16b2cf5ff4fd6d11e48b7ea7f4499163..d6b78dd71a18c32364a50fff011c8a5e27f34275 100644 (file)
@@ -986,7 +986,7 @@ no_cache:
             const bool ccMustRevalidate = (rep->cache_control->proxyRevalidate() || rep->cache_control->mustRevalidate());
 
             // CC:no-cache (only if there are no parameters)
-            const bool ccNoCacheNoParams = (rep->cache_control->hasNoCache() && rep->cache_control->noCache().undefined());
+            const bool ccNoCacheNoParams = (rep->cache_control->hasNoCache() && rep->cache_control->noCache().size()==0);
 
             // CC:s-maxage=N
             const bool ccSMaxAge = rep->cache_control->hasSMaxAge();
index c88b9a2989a2a2c7cb6f8dcc5b2ebd23b12c3a5b..a888b92a4a929a52a7534afe0cbfa9b021774155 100644 (file)
@@ -62,7 +62,7 @@ storeLog(int tag, const StoreEntry * e)
     MemObject *mem = e->mem_obj;
     HttpReply const *reply;
 
-    if (str_unknown.undefined())
+    if (str_unknown.size()==0)
         str_unknown="unknown"; //hack. Delay initialization as string doesn't support global variables..
 
     if (NULL == storelog)