]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Shuffle packerAppend() to Packer::append() method
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Mar 2015 05:16:48 +0000 (21:16 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Mar 2015 05:16:48 +0000 (21:16 -0800)
src/HttpBody.cc
src/HttpHdrRange.cc
src/HttpHeader.cc
src/HttpMsg.cc
src/HttpReply.cc
src/HttpRequest.cc
src/Packer.cc
src/Packer.h

index 27d2f863a99a860ea9194b010694416264d162f2..7b2b267267b9ca467b4a6c05c4c8ede9b4126bbc 100644 (file)
@@ -44,6 +44,6 @@ HttpBody::packInto(Packer * p) const
     assert(p);
 
     if (mb->contentSize())
-        packerAppend(p, mb->content(), mb->contentSize());
+        p->append(mb->content(), mb->contentSize());
 }
 
index 7a8bfdc39e22aa2d81a22613593c546dce8ff8ae..80d7e19905d37b1333b75efd611fb5c7217a2cdf 100644 (file)
@@ -309,7 +309,7 @@ HttpHdrRange::packInto(Packer * packer) const
 
     while (pos != end()) {
         if (pos != begin())
-            packerAppend(packer, ",", 1);
+            packer->append(",", 1);
 
         (*pos)->packInto(packer);
 
index 0095eaf31a28ab3207f744fc624b484daae6ef61..d71f3cf750bb38dbdfe962ea27f4978ff7c519ab 100644 (file)
@@ -765,8 +765,8 @@ HttpHeader::packInto(Packer * p, bool mask_sensitive_info) const
             break;
         }
         if (maskThisEntry) {
-            packerAppend(p, e->name.rawBuf(), e->name.size());
-            packerAppend(p, ": ** NOT DISPLAYED **\r\n", 23);
+            p->append(e->name.rawBuf(), e->name.size());
+            p->append(": ** NOT DISPLAYED **\r\n", 23);
         } else {
             e->packInto(p);
         }
@@ -1685,10 +1685,10 @@ void
 HttpHeaderEntry::packInto(Packer * p) const
 {
     assert(p);
-    packerAppend(p, name.rawBuf(), name.size());
-    packerAppend(p, ": ", 2);
-    packerAppend(p, value.rawBuf(), value.size());
-    packerAppend(p, "\r\n", 2);
+    p->append(name.rawBuf(), name.size());
+    p->append(": ", 2);
+    p->append(value.rawBuf(), value.size());
+    p->append("\r\n", 2);
 }
 
 int
index 59185ebb2247d417ff79d57052f3916e83a7c90c..527a53c173b07d1a6bc56bdee7ff2fc7fec38f51 100644 (file)
@@ -320,7 +320,7 @@ void HttpMsg::packInto(Packer *p, bool full_uri) const
 {
     packFirstLineInto(p, full_uri);
     header.packInto(p);
-    packerAppend(p, "\r\n", 2);
+    p->append("\r\n", 2);
 }
 
 void HttpMsg::hdrCacheInit()
index 22a2ab0f68ee55b9db6ce5006629b690aaaaf116..f599796d2911620da50f2384acb1b0b7b1cfc988 100644 (file)
@@ -112,7 +112,7 @@ HttpReply::packHeadersInto(Packer * p) const
 {
     sline.packInto(p);
     header.packInto(p);
-    packerAppend(p, "\r\n", 2);
+    p->append("\r\n", 2);
 }
 
 void
index 9f60ad7cc815594920775f2a852dd204387c8958..942a2e84709363bf0be378c7762b185214515bba 100644 (file)
@@ -383,7 +383,7 @@ HttpRequest::pack(Packer * p)
     /* headers */
     header.packInto(p);
     /* trailer */
-    packerAppend(p, "\r\n", 2);
+    p->append("\r\n", 2);
 }
 
 /*
index a39b6303feff1d905470c82026e410ad50974a99..b9f7675459baf1d96fac8326c7389e659ff1b364 100644 (file)
@@ -88,7 +88,7 @@ void
 packerToStoreInit(Packer * p, StoreEntry * e)
 {
     assert(p && e);
-    p->append = (append_f) store_append;
+    p->append_ = (append_f) store_append;
     p->packer_vprintf = (vprintf_f) store_vprintf;
     p->real_handler = e;
     e->buffer();
@@ -99,28 +99,27 @@ void
 packerToMemInit(Packer * p, MemBuf * mb)
 {
     assert(p && mb);
-    p->append = (append_f) memBuf_append;
+    p->append_ = (append_f) memBuf_append;
     p->packer_vprintf = (vprintf_f) memBuf_vprintf;
     p->real_handler = mb;
 }
 
 Packer::~Packer()
 {
-    if (append == (append_f) store_append && real_handler)
+    if (append_ == (append_f) store_append && real_handler)
         static_cast<StoreEntry*>(real_handler)->flush();
 
     /* it is not really necessary to do this, but, just in case... */
-    append = NULL;
+    append_ = NULL;
     packer_vprintf = NULL;
     real_handler = NULL;
 }
 
 void
-packerAppend(Packer * p, const char *buf, int sz)
+Packer::append(const char *buf, int sz)
 {
-    assert(p);
-    assert(p->real_handler && p->append);
-    p->append(p->real_handler, buf, sz);
+    assert(real_handler && append_);
+    append_(real_handler, buf, sz);
 }
 
 void
index 0cba84687600ac7a74dcb81f6e8b4aecc0921787..964913aad2c47eb5adf4b0520d5ffea855a774fb 100644 (file)
@@ -24,14 +24,14 @@ class Packer
 
 public:
     virtual ~Packer();
+    virtual void append(const char *buf, int size);
 
     /* protected, use interface functions instead */
-    append_f append;
+    append_f append_;
     vprintf_f packer_vprintf;
     void *real_handler;     /* first parameter to real append and vprintf */
 };
 
-void packerAppend(Packer * p, const char *buf, int size);
 void packerPrintf(Packer * p, const char *fmt,...) PRINTF_FORMAT_ARG2;
 
 #endif /* SQUID_PACKER_H */