/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include "squid.h"
#include "acl/Checklist.h"
#include "acl/StringData.h"
-#include "cache_cf.h"
+#include "ConfigParser.h"
#include "Debug.h"
ACLStringData::ACLStringData(ACLStringData const &old) : stringValues(old.stringValues)
}
bool
-ACLStringData::match(char const *toFind)
+ACLStringData::match(const SBuf &tf)
{
- if (stringValues.empty() || !toFind)
+ if (stringValues.empty() || tf.isEmpty())
return 0;
- SBuf tf(toFind);
debugs(28, 3, "aclMatchStringList: checking '" << tf << "'");
bool found = (stringValues.find(tf) != stringValues.end());
return found;
}
+// XXX: performance regression due to SBuf(char*) data-copies.
+bool
+ACLStringData::match(char const *toFind)
+{
+ return match(SBuf(toFind));
+}
+
SBufList
ACLStringData::dump() const
{
void
ACLStringData::parse()
{
- char *t;
- while ((t = strtokFile()))
+ while (const char *t = ConfigParser::strtokFile())
stringValues.insert(SBuf(t));
}