From: Amos Jeffries Date: Tue, 9 Aug 2011 14:01:18 +0000 (+1200) Subject: regex optimization: const-correctness X-Git-Tag: take08~43^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e022e8c6145c43538640badca5efc3cdbd5d43d7;p=thirdparty%2Fsquid.git regex optimization: const-correctness --- diff --git a/src/acl/RegexData.cc b/src/acl/RegexData.cc index 93c829b054..80e7e7defb 100644 --- a/src/acl/RegexData.cc +++ b/src/acl/RegexData.cc @@ -124,7 +124,7 @@ ACLRegexData::dump() return W; } -static char * +static const char * removeUnnecessaryWildcards(char * t) { char * orig = t; @@ -318,13 +318,13 @@ aclParseRegexList(relist **curlist) debugs(28, 2, HERE << "aclParseRegexList: new Regex line or file"); while ((t = ConfigParser::strtokFile()) != NULL) { - t = removeUnnecessaryWildcards(t); - if (strlen(t) > BUFSIZ-1) { + const char *clean = removeUnnecessaryWildcards(t); + if (strlen(clean) > BUFSIZ-1) { debugs(28, DBG_CRITICAL, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line); - debugs(28, DBG_CRITICAL, "ERROR: Skipping regular expression. Larger than " << BUFSIZ-1 << " characters: '" << wl->key << "'"); + debugs(28, DBG_CRITICAL, "ERROR: Skipping regular expression. Larger than " << BUFSIZ-1 << " characters: '" << clean << "'"); } else { - debugs(28, 3, "aclParseRegexList: buffering RE '" << t << "'"); - wordlistAdd(&wl, t); + debugs(28, 3, "aclParseRegexList: buffering RE '" << clean << "'"); + wordlistAdd(&wl, clean); } }