]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/acl/StringData.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / acl / StringData.cc
index 9432f54202ab4c67e6dee34727cf34596ee381df..3bec669a2ca770d00b448c8da4cb0d93150bfc3a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -25,12 +25,11 @@ ACLStringData::insert(const char *value)
 }
 
 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());
@@ -39,6 +38,13 @@ ACLStringData::match(char const *toFind)
     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
 {