]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed httpHdrCcParseCreate as a first-class method, it only had one in-class caller.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 12 Sep 2011 16:07:03 +0000 (18:07 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 12 Sep 2011 16:07:03 +0000 (18:07 +0200)
HttpHdrCc::parseInit now takes a const String reference argument.

Same function of httpHdrCcParseCreate can be obtained by new HttpHdrCc() + HttpHdrCc::parseInit()

src/HttpHeader.cc
src/HttpHeaderCacheControl.cc
src/HttpHeaderCacheControl.h
src/protos.h

index 274505aee0946f063c9f6843fe3935d4b8a7ce14..43158c1dd52325b8bfa840c9ca425093b41ca75e 100644 (file)
@@ -1319,7 +1319,11 @@ HttpHeader::getCc() const
 
     getList(HDR_CACHE_CONTROL, &s);
 
-    cc = httpHdrCcParseCreate(&s);
+    cc=new HttpHdrCc();
+    if (!cc->parseInit(s)) {
+        delete cc;
+        cc = NULL;
+    }
 
     HttpHeaderStats[owner].ccParsedCount++;
 
index fb4374aa0b450cb6b81708fa3eeb767a27808b8f..07e0c8fea6d68c7ae05d5470096fffab8863eec4 100644 (file)
@@ -98,23 +98,9 @@ httpHdrCcCleanModule(void)
     // HdrCcNameToIdMap is self-cleaning
 }
 
-/* creates an cc object from a 0-terminating string */
-HttpHdrCc *
-httpHdrCcParseCreate(const String * str)
-{
-    HttpHdrCc *cc = new HttpHdrCc();
-
-    if (!cc->parseInit(str)) {
-        delete cc;
-        cc = NULL;
-    }
-
-    return cc;
-}
-
 /* parses a 0-terminating string and inits cc */
 bool
-HttpHdrCc::parseInit(const String * str)
+HttpHdrCc::parseInit(const String & str)
 {
     const char *item;
     const char *p;             /* '=' parameter */
@@ -122,11 +108,10 @@ HttpHdrCc::parseInit(const String * str)
     http_hdr_cc_type type;
     int ilen;
     int nlen;
-    assert(str);
 
     /* iterate through comma separated list */
 
-    while (strListGetItem(str, ',', &item, &ilen, &pos)) {
+    while (strListGetItem(&str, ',', &item, &ilen, &pos)) {
         String tmpstr;
         /* isolate directive name */
 
index f6a5dd58ebc8f147eb81e45d30be462b62cfcab8..b09eb29f40a50b371fe607a5d7aea875220f6c6a 100644 (file)
@@ -56,13 +56,11 @@ public:
             mask(0), max_age(max_age_), s_maxage(s_maxage_),
             max_stale(max_stale_), stale_if_error(0),
             min_fresh(min_fresh_) {}
+    /// (re)initialize by parsing the supplied Cache-control header string
+    bool parseInit(const String &s);
 
     MEMPROXY_CLASS(HttpHdrCc);
 
-//TODO: make private:
-    /// (re)initialize by parsing the supplied Cache-control header string
-    bool parseInit(const String *s);
-
 };
 
 MEMPROXY_CLASS_INLINE(HttpHdrCc);
index 7c1bd6e3820b66ce52f3aed0f142e9fed3d63d19..189d3cd704307fd451d8ced5f3bf3083eec6cc53 100644 (file)
@@ -237,7 +237,6 @@ SQUIDCEXTERN void httpBodyPackInto(const HttpBody * body, Packer * p);
 /* Http Cache Control Header Field */
 SQUIDCEXTERN void httpHdrCcInitModule(void);
 SQUIDCEXTERN void httpHdrCcCleanModule(void);
-SQUIDCEXTERN HttpHdrCc *httpHdrCcParseCreate(const String * str);
 SQUIDCEXTERN void httpHdrCcDestroy(HttpHdrCc * cc);
 SQUIDCEXTERN HttpHdrCc *httpHdrCcDup(const HttpHdrCc * cc);
 SQUIDCEXTERN void httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p);