From: Amos Jeffries Date: Thu, 31 Oct 2013 19:13:17 +0000 (-0600) Subject: Drop String::undefined() X-Git-Tag: SQUID_3_5_0_1~539 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a137769815a6e9de6c2c46c4f8bbfcf2359c082b;p=thirdparty%2Fsquid.git Drop String::undefined() 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. --- diff --git a/src/HttpHdrSc.cc b/src/HttpHdrSc.cc index 52dc243046..523fe772fd 100644 --- a/src/HttpHdrSc.cc +++ b/src/HttpHdrSc.cc @@ -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; diff --git a/src/HttpReply.cc b/src/HttpReply.cc index fffa869c60..a7df80b8a9 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -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; diff --git a/src/acl/HttpHeaderData.cc b/src/acl/HttpHeaderData.cc index 56e1632aff..580ade10ff 100644 --- a/src/acl/HttpHeaderData.cc +++ b/src/acl/HttpHeaderData.cc @@ -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 * diff --git a/src/acl/NoteData.cc b/src/acl/NoteData.cc index 3195971ee3..ab4e4cfb67 100644 --- a/src/acl/NoteData.cc +++ b/src/acl/NoteData.cc @@ -74,7 +74,7 @@ ACLNoteData::parse() bool ACLNoteData::empty() const { - return name.undefined(); + return name.size() == 0; } ACLData * diff --git a/src/ftp.cc b/src/ftp.cc index fb320b0664..f4b1080809 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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) { diff --git a/src/http.cc b/src/http.cc index 9a8f6ddf16..d6b78dd71a 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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(); diff --git a/src/store_log.cc b/src/store_log.cc index c88b9a2989..a888b92a4a 100644 --- a/src/store_log.cc +++ b/src/store_log.cc @@ -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)