TS-2323: simplify is_inkeylist helper is_inkeylist doesn't need to elide '.' and '_' for the 2 places its actually being used in.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/812edfee Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/812edfee Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/812edfee Branch: refs/heads/master Commit: 812edfee2f3e95b1e12811e4efd064a102b272ea Parents: 4be46fb Author: James Peach <[email protected]> Authored: Wed Oct 30 14:05:44 2013 -0700 Committer: James Peach <[email protected]> Committed: Tue Nov 5 16:46:22 2013 -0800 ---------------------------------------------------------------------- proxy/http/remap/RemapConfig.cc | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/812edfee/proxy/http/remap/RemapConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc index bc5c86d..23b0425 100644 --- a/proxy/http/remap/RemapConfig.cc +++ b/proxy/http/remap/RemapConfig.cc @@ -28,34 +28,22 @@ static bool is_inkeylist(const char * key, ...) { - unsigned i; va_list ap; if (unlikely(key == NULL || key[0] == '\0')) { return false; } - char tmpkey[512]; va_start(ap, key); - for (i = 0; i < (sizeof(tmpkey) - 2) && (tmpkey[i] = *key++) != 0;) { - if (tmpkey[i] != '_' && tmpkey[i] != '.') { - i++; + const char *str = va_arg(ap, const char *); + for (unsigned idx = 1; str; idx++) { + if (!strcasecmp(key, str)) { + va_end(ap); + return true; } - } - - tmpkey[i] = 0; - if (tmpkey[0]) { - const char *str = va_arg(ap, const char *); - for (unsigned idx = 1; str; idx++) { - if (!strcasecmp(tmpkey, str)) { - va_end(ap); - return true; - } - - str = va_arg(ap, const char *); - } + str = va_arg(ap, const char *); } va_end(ap);
