]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: Removed unused bits of Format::FmtConfig code (#1681)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 16 Feb 2024 13:02:54 +0000 (13:02 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 17 Feb 2024 21:23:32 +0000 (21:23 +0000)
This code was probably accidentally copied from Log::LogConfig when
FmtConfig was created in 2011 commit 31971e6. It mentions logfile_format
directive that never existed. The code also duplicates a dangerous
Log::LogConfig snippet (see Bug 5344).

src/format/Config.cc
src/format/Config.h

index 5950ef69fec271d1966f0e879f29117a50bb1e13..53b9d47361c553349e83fdfa9649026a4dbf050d 100644 (file)
@@ -8,42 +8,11 @@
 
 #include "squid.h"
 #include "cache_cf.h"
-#include "ConfigParser.h"
 #include "debug/Stream.h"
 #include "format/Config.h"
-#include <list>
 
 Format::FmtConfig Format::TheConfig;
 
-void
-Format::FmtConfig::parseFormats()
-{
-    char *name, *def;
-
-    if ((name = ConfigParser::NextToken()) == nullptr) {
-        self_destruct();
-        return;
-    }
-
-    if ((def = ConfigParser::NextQuotedOrToEol()) == nullptr) {
-        self_destruct();
-        return;
-    }
-
-    debugs(3, 2, "Custom Format for '" << name << "' is '" << def << "'");
-
-    Format *nlf = new Format(name);
-
-    if (!nlf->parse(def)) {
-        self_destruct();
-        return;
-    }
-
-    // add to global config list
-    nlf->next = formats;
-    formats = nlf;
-}
-
 void
 Format::FmtConfig::registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray)
 {
index df0380d2042371a40e6610dd4fb9b99932131a49..2cf0dcea8b00762ca7c914ef74fc05c80b9695d0 100644 (file)
@@ -9,13 +9,10 @@
 #ifndef SQUID_SRC_FORMAT_CONFIG_H
 #define SQUID_SRC_FORMAT_CONFIG_H
 
-#include "format/Format.h"
-#include "SquidString.h"
+#include "sbuf/SBuf.h"
 
 #include <list>
 
-class StoreEntry;
-
 namespace Format
 {
 
@@ -38,18 +35,9 @@ public:
 };
 
 /// The set of custom formats defined in squid.conf
-///
 class FmtConfig
 {
 public:
-    /// Parse a log format directive line (logfile_format)
-    void parseFormats();
-
-    /// Dump/display the formats currently known to the provided StoreEntry object
-    void dumpFormats(StoreEntry *e, const char *name) {
-        formats->dump(e, name);
-    }
-
     /* Register a namespace set of tokens to be accepted by the format parser.
      * Multiple arrays can be registered, they will be scanned for
      * in order registered. So care needs to be taken that arrays registered
@@ -57,29 +45,13 @@ public:
      */
     void registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray);
 
-    /// Linked list of custom formats
-    Format *formats;
-
     /// list of token namespaces registered
     std::list<TokenNamespace> tokens;
-
-#if USE_ADAPTATION
-    bool hasAdaptToken;
-#endif
-
-#if ICAP_CLIENT
-    bool hasIcapToken;
-#endif
 };
 
 extern FmtConfig TheConfig;
 
 } // namespace Format
 
-// Legacy parsing wrappers
-#define parse_format(X)  (X)->parseFormats()
-#define free_format(X)   do{ delete (*(X)).formats; (*(X)).formats=NULL; }while(false)
-#define dump_format(E,N,D) (D).dumpFormats((E),(N))
-
 #endif /* SQUID_SRC_FORMAT_CONFIG_H */