]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat Enforcement
authorAutomatic source maintenance <squidadm@squid-cache.org>
Sun, 4 Dec 2011 01:33:38 +0000 (18:33 -0700)
committerAutomatic source maintenance <squidadm@squid-cache.org>
Sun, 4 Dec 2011 01:33:38 +0000 (18:33 -0700)
compat/strnrchr.c
src/HttpHdrSc.cc
src/HttpHdrScTarget.h
src/esi/Esi.cc

index 1e5331968a6062834d1233ec820ddf38643b3ee1..d5d1753553298648fd632a24fc0bb85694b02e6a 100644 (file)
 const char *
 strnrchr(const char *s, size_t count, int c)
 {
-       const char *rv=NULL;
-       const char *l=s;
-       while (count > 0 && *l != 0) {
-               if (*l==c)
-                       rv=l;
-               ++l;
-               --count;
-       }
-       return rv;
+    const char *rv=NULL;
+    const char *l=s;
+    while (count > 0 && *l != 0) {
+        if (*l==c)
+            rv=l;
+        ++l;
+        --count;
+    }
+    return rv;
 }
index 8ad07c49ef0905f8038899bced77c90591a4b4c5..7812b1dfd191a0b7e7f2af12bfa97f316f82bd43 100644 (file)
@@ -47,9 +47,9 @@
 
 /* a row in the table used for parsing surrogate-control header and statistics */
 typedef struct {
-       const char *name;
-       http_hdr_sc_type id;
-       HttpHeaderFieldStat stat;
+    const char *name;
+    http_hdr_sc_type id;
+    HttpHeaderFieldStat stat;
 } HttpHeaderScFields;
 
 /* this table is used for parsing surrogate control header */
@@ -189,39 +189,38 @@ HttpHdrSc::parse(const String * str)
             sct->noStoreRemote(true);
             break;
 
-        case SC_MAX_AGE:
-               {
-                   int ma;
-                   if (p && httpHeaderParseInt(p, &ma)) {
-                       sct->maxAge(ma);
-                   } else {
-                       debugs(90, 2, "sc: invalid max-age specs near '" << item << "'");
-                       sct->clearMaxAge();
-                   }
-
-                   if ((p = strchr (p, '+'))) {
-                       int ms;
-                       ++p; //skip the + char
-                       if (httpHeaderParseInt(p, &ms)) {
-                           sct->maxStale(ms);
-                       } else {
-                           debugs(90, 2, "sc: invalid max-stale specs near '" << item << "'");
-                           sct->clearMaxStale();
-                           /* leave the max-age alone */
-                       }
-                   }
-                   break;
-               }
+        case SC_MAX_AGE: {
+            int ma;
+            if (p && httpHeaderParseInt(p, &ma)) {
+                sct->maxAge(ma);
+            } else {
+                debugs(90, 2, "sc: invalid max-age specs near '" << item << "'");
+                sct->clearMaxAge();
+            }
+
+            if ((p = strchr (p, '+'))) {
+                int ms;
+                ++p; //skip the + char
+                if (httpHeaderParseInt(p, &ms)) {
+                    sct->maxStale(ms);
+                } else {
+                    debugs(90, 2, "sc: invalid max-stale specs near '" << item << "'");
+                    sct->clearMaxStale();
+                    /* leave the max-age alone */
+                }
+            }
+            break;
+        }
 
         case SC_CONTENT:
 
-               if ( p && httpHeaderParseQuotedString(p, vlen, &sct->content_)) {
-                       sct->setMask(SC_CONTENT,true); // ugly but saves a copy
-               } else {
+            if ( p && httpHeaderParseQuotedString(p, vlen, &sct->content_)) {
+                sct->setMask(SC_CONTENT,true); // ugly but saves a copy
+            } else {
                 debugs(90, 2, "sc: invalid content= quoted string near '" << item << "'");
                 sct->clearContent();
             }
-               break;
+            break;
 
         case SC_OTHER:
         default:
@@ -296,7 +295,7 @@ HttpHdrSc::packInto(Packer * p) const
     node = targets.head;
 
     while (node) {
-       static_cast<HttpHdrScTarget *>(node->data)->packInto(p);
+        static_cast<HttpHdrScTarget *>(node->data)->packInto(p);
         node = node->next;
     }
 }
@@ -321,7 +320,7 @@ HttpHdrSc::updateStats(StatHist * hist) const
     dlink_node *sct = targets.head;
 
     while (sct) {
-       static_cast<HttpHdrScTarget *>(sct->data)->updateStats(hist);
+        static_cast<HttpHdrScTarget *>(sct->data)->updateStats(hist);
         sct = sct->next;
     }
 }
index 91ce11cbb37ae989e8b0b11e196ee1cee99176bb..18b1843c2abedb4df3f50939415618c6898b41f4 100644 (file)
@@ -49,16 +49,16 @@ class HttpHdrScTarget
     // parsing is done in HttpHdrSc, need to grant them access.
     friend class HttpHdrSc;
 public:
-       static const int MAX_AGE_UNSET=-1; //max-age is unset
-       static const int MAX_STALE_UNSET=0; //max-stale is unset
+    static const int MAX_AGE_UNSET=-1; //max-age is unset
+    static const int MAX_STALE_UNSET=0; //max-stale is unset
 
     HttpHdrScTarget(const char *target_):
-        mask(0), max_age(MAX_AGE_UNSET), max_stale(MAX_STALE_UNSET),target(target_) {}
+            mask(0), max_age(MAX_AGE_UNSET), max_stale(MAX_STALE_UNSET),target(target_) {}
     HttpHdrScTarget(const String &target_):
-        mask(0), max_age(MAX_AGE_UNSET), max_stale(MAX_STALE_UNSET),target(target_) {}
+            mask(0), max_age(MAX_AGE_UNSET), max_stale(MAX_STALE_UNSET),target(target_) {}
     HttpHdrScTarget(const HttpHdrScTarget &t):
-        mask(t.mask), max_age(t.max_age), max_stale(t.max_stale),
-        content_(t.content_), target(t.target) {}
+            mask(t.mask), max_age(t.max_age), max_stale(t.max_stale),
+            content_(t.content_), target(t.target) {}
 
     bool hasNoStore() const {return isSet(SC_NO_STORE); }
     void noStore(bool v) { setMask(SC_NO_STORE,v); }
@@ -72,13 +72,13 @@ public:
 
     bool hasMaxAge() const { return isSet(SC_MAX_AGE); }
     void maxAge(int v) {
-       if (v >= 0) { //setting
-               setMask(SC_MAX_AGE,true);
-               max_age=v;
-       } else {
-               setMask(SC_MAX_AGE,false);
-               max_age=MAX_AGE_UNSET;
-       }
+        if (v >= 0) { //setting
+            setMask(SC_MAX_AGE,true);
+            max_age=v;
+        } else {
+            setMask(SC_MAX_AGE,false);
+            max_age=MAX_AGE_UNSET;
+        }
     }
     int maxAge() const { return max_age; }
     void clearMaxAge() { setMask(SC_MAX_AGE,false); max_age=MAX_AGE_UNSET; }
@@ -91,8 +91,8 @@ public:
 
     bool hasContent() const { return isSet(SC_CONTENT); }
     void Content(const String &v) {
-       setMask(SC_CONTENT,true);
-       content_=v;
+        setMask(SC_CONTENT,true);
+        content_=v;
     }
     String content() const { return content_; }
     void clearContent() { setMask(SC_CONTENT,false); content_.clean(); }
index 0bcc5dfbe20a200462562002b2fb810daf400b23..0c8d78fbbb951186285fa80d154bb3e878ff678e 100644 (file)
@@ -2433,7 +2433,7 @@ esiEnableProcessing (HttpReply *rep)
 
     if (rep->surrogate_control) {
         HttpHdrScTarget *sctusable =
-                rep->surrogate_control->getMergedTarget(Config.Accel.surrogate_id);
+            rep->surrogate_control->getMergedTarget(Config.Accel.surrogate_id);
 
         if (!sctusable || !sctusable->hasContent())
             /* Nothing generic or targeted at us, or no