Repository: trafficserver Updated Branches: refs/heads/master 29521feca -> 10df89f36
TS-1475: remove regex_remap simple micro-optimization The regex_remap simple regex optimization ends failing to initialize the matching strings. Since this is a micro-optimization, just remove the whole notion of a simple regex match. Coverity #1021771 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/10df89f3 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/10df89f3 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/10df89f3 Branch: refs/heads/master Commit: 10df89f36b15811f4ecf2021985655668dbdfc00 Parents: 29521fe Author: James Peach <jpe...@apache.org> Authored: Mon Jul 14 15:11:44 2014 -0600 Committer: James Peach <jpe...@apache.org> Committed: Mon Jul 14 15:15:08 2014 -0600 ---------------------------------------------------------------------- plugins/regex_remap/regex_remap.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/10df89f3/plugins/regex_remap/regex_remap.cc ---------------------------------------------------------------------- diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc index d489dc2..2b10bed 100644 --- a/plugins/regex_remap/regex_remap.cc +++ b/plugins/regex_remap/regex_remap.cc @@ -118,7 +118,7 @@ class RemapRegex public: RemapRegex() : _num_subs(-1), _rex(NULL), _extra(NULL), _options(0), _order(-1), - _simple(false), _lowercase_substitutions(false), + _lowercase_substitutions(false), _active_timeout(-1), _no_activity_timeout(-1), _connect_timeout(-1), _dns_timeout(-1), _first_override(NULL) { @@ -182,8 +182,6 @@ class RemapRegex inline const char* substitution() const { return _subst; } inline int substitutions_used() const { return _num_subs; } - inline bool is_simple() const { return _simple; } - inline TSHttpStatus status_option() const { return _status; } inline int active_timeout_option() const { return _active_timeout; } inline int no_activity_timeout_option() const { return _no_activity_timeout; } @@ -217,7 +215,6 @@ class RemapRegex RemapRegex* _next; int _order; TSHttpStatus _status; - bool _simple; bool _lowercase_substitutions; int _active_timeout; int _no_activity_timeout; @@ -233,10 +230,6 @@ RemapRegex::initialize(const std::string& reg, const std::string& sub, const std _status = static_cast<TSHttpStatus>(0); if (!reg.empty()) { - if (reg == ".") { - TSDebug(PLUGIN_NAME, "Rule is simple, and fast!"); - _simple = true; - } _rex_string = TSstrdup(reg.c_str()); } else _rex_string = NULL; @@ -930,7 +923,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri) // Apply the regular expressions, in order. First one wins. while (re) { // Since we check substitutions on parse time, we don't need to reset ovector - if (re->is_simple() || (re->match(match_buf, match_len, ovector) != -1)) { + if (re->match(match_buf, match_len, ovector) != -1) { int new_len = re->get_lengths(ovector, lengths, rri, &req_url); // Set timeouts