]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanu: Remove dead Packer API
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 26 May 2015 09:18:13 +0000 (02:18 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 26 May 2015 09:18:13 +0000 (02:18 -0700)
Also includes some Packable API polishing. No logical changes.

src/HttpHdrContRange.cc
src/HttpHeaderRange.h
src/Makefile.am
src/Packer.cc [deleted file]
src/Packer.h [deleted file]
src/base/Packable.h
src/http/StatusLine.cc
src/http/StatusLine.h
src/tests/stub_store.cc
src/tools.h

index c89c20f0a4af29ebac5ef276a67b9785b621ea0b..1e4fc9849b59088731ee76de9701495fe89ed9ba 100644 (file)
@@ -9,6 +9,7 @@
 /* DEBUG: section 68    HTTP Content-Range Header */
 
 #include "squid.h"
+#include "base/Packable.h"
 #include "Debug.h"
 #include "enums.h"
 #include "HttpHdrContRange.h"
index 448e0ebf45b388bb2df526351caaf04a6a513bad..6e9e2a0fc707b1ee90db3578693fc23f0635b2cb 100644 (file)
 #define SQUID_HTTPHEADERRANGE_H
 
 #include "mem/forward.h"
-#include "Packer.h"
 #include "Range.h"
 #include "SquidString.h"
 
 #include <vector>
 
 class HttpReply;
+class Packable;
+
 /* http byte-range-spec */
 
 class HttpHdrRangeSpec
index cf73fe2f99b5cbc5516965f43e85d9faae4bb1b7..349fcae9d982cbad30ee52f939f5a13b624a2a9b 100644 (file)
@@ -440,8 +440,6 @@ squid_SOURCES = \
        neighbors.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
-       Packer.h \
        Parsing.cc \
        Parsing.h \
        $(XPROF_STATS_SOURCE) \
@@ -1146,8 +1144,6 @@ tests_testHttpReply_SOURCES=\
        mime_header.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
-       Packer.h \
        SquidString.h \
        SquidTime.h \
        $(SBUF_SOURCE) \
@@ -1253,7 +1249,6 @@ tests_testACLMaxUserIP_SOURCES= \
        SquidList.h \
        SquidList.cc \
        mem_node.cc \
-       Packer.cc \
        Parsing.cc \
        SquidMath.cc \
        StatCounters.cc \
@@ -1496,7 +1491,6 @@ tests_testCacheManager_SOURCES = \
        neighbors.cc \
        Notes.cc \
        Notes.h \
-       Packer.cc \
        Parsing.cc \
        pconn.cc \
        peer_digest.cc \
@@ -1676,7 +1670,6 @@ tests_testDiskIO_SOURCES = \
        mem_node.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
        Parsing.cc \
        refresh.h \
        refresh.cc \
@@ -1937,7 +1930,6 @@ tests_testEvent_SOURCES = \
        neighbors.cc \
        Notes.cc \
        Notes.h \
-       Packer.cc \
        Parsing.cc \
        pconn.cc \
        peer_digest.cc \
@@ -2184,7 +2176,6 @@ tests_testEventLoop_SOURCES = \
        neighbors.cc \
        Notes.cc \
        Notes.h \
-       Packer.cc \
        Parsing.cc \
        pconn.cc \
        peer_digest.cc \
@@ -2426,7 +2417,6 @@ tests_test_http_range_SOURCES = \
        neighbors.cc \
        Notes.cc \
        Notes.h \
-       Packer.cc \
        Parsing.cc \
        peer_digest.cc \
        peer_proxy_negotiate_auth.h \
@@ -2722,7 +2712,6 @@ tests_testHttpRequest_SOURCES = \
        neighbors.cc \
        Notes.cc \
        Notes.h \
-       Packer.cc \
        Parsing.cc \
        pconn.cc \
        peer_digest.cc \
@@ -2894,7 +2883,6 @@ tests_testStore_SOURCES= \
        MemObject.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
        Parsing.cc \
        RemovalPolicy.cc \
        refresh.h \
@@ -3176,7 +3164,6 @@ tests_testUfs_SOURCES = \
        ClientInfo.h \
        MemBuf.cc \
        HttpHdrContRange.cc \
-       Packer.cc \
        HttpHeaderFieldStat.h \
        HttpHdrCc.h \
        HttpHdrCc.cc \
@@ -3313,7 +3300,6 @@ tests_testRock_SOURCES = \
        mem_node.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
        Parsing.cc \
        RemovalPolicy.cc \
        RequestFlags.cc \
@@ -3544,7 +3530,6 @@ tests_testURL_SOURCES = \
        neighbors.cc \
        Notes.h \
        Notes.cc \
-       Packer.cc \
        Parsing.cc \
        pconn.cc \
        peer_digest.cc \
diff --git a/src/Packer.cc b/src/Packer.cc
deleted file mode 100644 (file)
index 55778cc..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 60    Generic Data Packer */
-
-#include "squid.h"
-#include "Packer.h"
-#include "Store.h"
-
-/*
- * We do have one potential problem here. Both append_f and vprintf_f types
- * cannot match real functions precisely (at least because of the difference in
- * the type of the first parameter). Thus, we have to use type cast. If somebody
- * changes the prototypes of real functions, Packer will not notice that because
- * of the type cast.
- *
- * Solution: we use the constants below to *hard code* current prototypes of
- * real functions. If real prototypes change, these constants will produce a
- * warning (e.g., "warning: assignment from incompatible pointer type").
- */
-
-static void
-storeEntryAppend(StoreEntry *e, const char *buf, int len)
-{
-    e->append(buf, len);
-}
-
-/* append()'s */
-static void (*const store_append) (StoreEntry *, const char *, int) = &storeEntryAppend;
-
-/* vprintf()'s */
-static void (*const store_vprintf) (StoreEntry *, const char *, va_list ap) = &storeAppendVPrintf;
-
-/* init/clean */
-
-/* init with this to forward data to StoreEntry */
-void
-packerToStoreInit(Packer * p, StoreEntry * e)
-{
-    assert(p && e);
-    p->append_ = (append_f) store_append;
-    p->packer_vprintf = (vprintf_f) store_vprintf;
-    p->real_handler = e;
-    e->buffer();
-}
-
-Packer::~Packer()
-{
-    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;
-    packer_vprintf = NULL;
-    real_handler = NULL;
-}
-
-void
-Packer::append(const char *buf, int sz)
-{
-    assert(real_handler && append_);
-    append_(real_handler, buf, sz);
-}
-
-void
-Packer::vappendf(const char *fmt, va_list args)
-{
-    assert(real_handler && packer_vprintf);
-    packer_vprintf(real_handler, fmt, args);
-}
-
diff --git a/src/Packer.h b/src/Packer.h
deleted file mode 100644 (file)
index c8b55eb..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef SQUID_PACKER_H
-#define SQUID_PACKER_H
-
-#include "base/Packable.h"
-
-/* see Packer.cc for description */
-class Packer;
-
-/* a common objPackInto interface; used by debugObj */
-typedef void (*ObjPackMethod) (void *obj, Packable * p);
-
-/* append/vprintf's for Packer */
-typedef void (*append_f) (void *, const char *buf, int size);
-typedef void (*vprintf_f) (void *, const char *fmt, va_list args);
-
-class Packer : public Packable
-{
-
-public:
-    virtual ~Packer();
-
-    /* Packable API */
-    virtual void append(const char *buf, int size);
-    virtual void vappendf(const char *fmt, va_list ap);
-
-    /* protected, use interface functions instead */
-    append_f append_;
-    vprintf_f packer_vprintf;
-    void *real_handler;     /* first parameter to real append and vprintf */
-};
-
-#endif /* SQUID_PACKER_H */
-
index fd1dc01ad08a8d4a26f75a6da5a694a8d7f4bb54..16e777038857caa5b2de1e314414b35882b74def 100644 (file)
@@ -42,7 +42,7 @@
  * storeAppend. Packable buffer objects retain the data such that it can be
  * flushed later to Comm::Write.
  *
- * Thus, one can write just one function that will take a Packer* pointer
+ * Thus, one can write just one function that will take a Packable object
  * and either "pack" things for Comm::Write or "append" things to Store,
  * depending on actual Packable object supplied.
  */
@@ -60,19 +60,6 @@ public:
         vappendf(fmt, args);
         va_end(args);
     }
-#if 0
-    /*
-     * \note  we use Printf instead of printf so the compiler won't
-     *        think we're calling the libc printf()
-     */
-    void Printf(const char *fmt,...) PRINTF_FORMAT_ARG2
-    {
-        va_list args;
-        va_start(args, fmt);
-        vappendf(fmt, args);
-        va_end(args);
-    }
-#endif
 
     /** Append operation, with vsprintf(3)-style arguments.
      *
index 4671dfda5c7cb498360ae2ff40ce98134db16e72..f561ebce94b60b238aeeaea862191214391d9ec3 100644 (file)
@@ -9,9 +9,9 @@
 /* DEBUG: section 57    HTTP Status-line */
 
 #include "squid.h"
+#include "base/Packable.h"
 #include "Debug.h"
 #include "http/StatusLine.h"
-#include "Packer.h"
 
 void
 Http::StatusLine::init()
index 608c8173aa29c555f20487e9e54c014ce2e7b68b..c34c76fa1a5bf30c2549fd29fb7c6e9288dbe859 100644 (file)
@@ -43,8 +43,8 @@ public:
     /// retrieve the reason string for this status line
     const char *reason() const;
 
-    /// pack fields using Packer
-    void packInto(Packable * p) const;
+    /// pack fields into a Packable object
+    void packInto(Packable *) const;
 
     /**
      * Parse a buffer and fill internal structures;
index 6427a8008781b3208fbbbfeff4fd77a7b30b72f7..b6713a8e9f1166036ac4ae438fe286d4793894aa 100644 (file)
@@ -143,6 +143,5 @@ void storeFsInit(void) STUB
 void storeFsDone(void) STUB
 void storeReplAdd(const char *, REMOVALPOLICYCREATE *) STUB
 void destroyStoreEntry(void *) STUB
-// in Packer.cc !? void packerToStoreInit(Packer * p, StoreEntry * e) STUB
 void storeGetMemSpace(int size) STUB
 
index 7dd11670ae759b2121502c809a84ae54b6cebceb..af185be4427ca66ee44215f9fe43b5e42163d5aa 100644 (file)
@@ -11,7 +11,6 @@
 #ifndef SQUID_TOOLS_H_
 #define SQUID_TOOLS_H_
 
-#include "Packer.h"
 #include "SBuf.h"
 #include "SquidString.h"
 #include "typedefs.h"
@@ -30,6 +29,11 @@ int getMyPort(void);
 void setUmask(mode_t mask);
 void strwordquote(MemBuf * mb, const char *str);
 
+class Packable;
+
+/* a common objPackInto interface; used by debugObj */
+typedef void (*ObjPackMethod) (void *obj, Packable * p);
+
 /* packs, then prints an object using debugs() */
 void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm);