]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use StoreEntry Packable API directly without class Packer wrapper
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 25 May 2015 14:02:29 +0000 (07:02 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 25 May 2015 14:02:29 +0000 (07:02 -0700)
src/HttpRequest.cc
src/Store.h
src/store.cc
src/tests/testRock.cc
src/tests/testUfs.cc

index 95d6dd649b42371b283858cfdcaf143c149687ae..a39ac7079f2b86e025e4ef4c473517b421d2183b 100644 (file)
@@ -365,10 +365,9 @@ HttpRequest::parseHeader(Http1::RequestParser &hp)
 void
 HttpRequest::swapOut(StoreEntry * e)
 {
-    Packer p;
     assert(e);
-    packerToStoreInit(&p, e);
-    pack(&p);
+    e->buffer();
+    pack(e);
 }
 
 /* packs request-line and headers, appends <crlf> terminator */
index 1464639b6814178ab4bc8f885051e80772a4deef..dabbcee2253c3bc51398424690be4e515037e016 100644 (file)
@@ -31,7 +31,6 @@
 
 class AsyncCall;
 class HttpRequest;
-class Packer;
 class RequestFlags;
 class StoreClient;
 class StoreSearch;
@@ -497,12 +496,6 @@ void storeReplAdd(const char *, REMOVALPOLICYCREATE *);
 /// \ingroup StoreAPI
 extern FREE destroyStoreEntry;
 
-/**
- \ingroup StoreAPI
- \todo should be a subclass of Packer perhaps ?
- */
-void packerToStoreInit(Packer * p, StoreEntry * e);
-
 /// \ingroup StoreAPI
 void storeGetMemSpace(int size);
 
index 112f45477642f33374fc5a1bb6b585617581410b..55a54f4d05e41f48532f31c2c850433e6187c4ef 100644 (file)
@@ -1918,12 +1918,9 @@ StoreEntry::replaceHttpReply(HttpReply *rep, bool andStartWriting)
 void
 StoreEntry::startWriting()
 {
-    Packer p;
-
     /* TODO: when we store headers serparately remove the header portion */
     /* TODO: mark the length of the headers ? */
     /* We ONLY want the headers */
-    packerToStoreInit(&p, this);
 
     assert (isEmpty());
     assert(mem_obj);
@@ -1931,11 +1928,12 @@ StoreEntry::startWriting()
     const HttpReply *rep = getReply();
     assert(rep);
 
-    rep->packHeadersInto(&p);
+    buffer();
+    rep->packHeadersInto(this);
     mem_obj->markEndOfReplyHeaders();
     EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
 
-    rep->body.packInto(&p);
+    rep->body.packInto(this);
 }
 
 char const *
index c841c0c9131ec8ede6300791c39aefbad782b422..3e2c0ab33e57cd09416d169239229b2446f5f70c 100644 (file)
@@ -14,7 +14,6 @@
 #include "HttpHeader.h"
 #include "HttpReply.h"
 #include "MemObject.h"
-#include "Packer.h"
 #include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
@@ -202,13 +201,7 @@ testRock::addEntry(const int i)
     StoreEntry *const pe = createEntry(i);
 
     pe->buffer();
-    /* TODO: remove this when the metadata is separated */
-    {
-        Packer p;
-        packerToStoreInit(&p, pe);
-        pe->getReply()->packHeadersInto(&p);
-    }
-
+    pe->getReply()->packHeadersInto(pe);
     pe->flush();
     pe->timestampsSet();
     pe->complete();
index 35698e27e43823dcc828cba21caaba433d185a45..3665531d4ecb723f8a57ba97f4bd0ae5114d7c18 100644 (file)
@@ -13,7 +13,6 @@
 #include "HttpHeader.h"
 #include "HttpReply.h"
 #include "MemObject.h"
-#include "Packer.h"
 #include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
@@ -153,13 +152,7 @@ testUfs::testUfsSearch()
         pe->setPublicKey();
 
         pe->buffer();
-        /* TODO: remove this when the metadata is separated */
-        {
-            Packer p;
-            packerToStoreInit(&p, pe);
-            pe->getReply()->packHeadersInto(&p);
-        }
-
+        pe->getReply()->packHeadersInto(pe);
         pe->flush();
         pe->timestampsSet();
         pe->complete();