Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ConfigParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ bool ConfigParser::PreviewMode_ = false;

static const char *SQUID_ERROR_TOKEN = "[invalid token]";

ConfigParser &
Configuration::LegacyParser()
{
static ConfigParser *instance = new ConfigParser();
return *instance;
}

void
ConfigParser::destruct()
{
Expand Down
10 changes: 10 additions & 0 deletions src/ConfigParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ class ConfigParser
namespace Configuration {
/// interprets (and partially applies) squid.conf or equivalent configuration
void Parse();

/**
* A parser for legacy code that uses the global approach.
* Only valid when parsing squid.conf.
*
* Deprecated; code needing access to a ConfigParser should
* have it provided to them in their parseFoo() methods.
*/
ConfigParser &LegacyParser();

}

#endif /* SQUID_SRC_CONFIGPARSER_H */
Expand Down
8 changes: 4 additions & 4 deletions src/cache_cf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ static void free_http_upgrade_request_protocols(HttpUpgradeProtocolAccess **prot

/*
* LegacyParser is a parser for legacy code that uses the global
* approach. This is static so that it is only exposed to cache_cf.
* Other modules needing access to a ConfigParser should have it
* provided to them in their parserFOO methods.
* approach.
* Deprecated; other modules needing access to a ConfigParser should
* have it provided to them in their parseFoo() methods.
*/
static ConfigParser LegacyParser = ConfigParser();
static auto LegacyParser = Configuration::LegacyParser();

const char *cfg_directive = nullptr;
const char *cfg_filename = nullptr;
Expand Down
Loading