This is an automated email from the ASF dual-hosted git repository.

mochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new e3ecfaa90f Use single regex match for Diags tags (#12586)
e3ecfaa90f is described below

commit e3ecfaa90ff4eb5815803abf6a67b974dfe9e353
Author: Mo Chen <[email protected]>
AuthorDate: Mon Oct 20 17:26:43 2025 -0500

    Use single regex match for Diags tags (#12586)
    
    Even though we sometimes activate multiple debug tags for Diag, we still 
only use a single regex to achieve this purpose.  DFA is for matching multiple 
regexes.
---
 include/tscore/DiagsTypes.h | 2 +-
 src/tscore/Diags.cc         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/tscore/DiagsTypes.h b/include/tscore/DiagsTypes.h
index fa49f6041a..f770e871c4 100644
--- a/include/tscore/DiagsTypes.h
+++ b/include/tscore/DiagsTypes.h
@@ -244,7 +244,7 @@ public:
 private:
   const std::string prefix_str;
   mutable ink_mutex tag_table_lock;    // prevents reconfig/read races
-  DFA              *activated_tags[2]; // 1 table for debug, 1 for action
+  Regex            *activated_tags[2]; // 1 table for debug, 1 for action
 
   // These are the default logfile permissions
   int diags_logfile_perm  = -1;
diff --git a/src/tscore/Diags.cc b/src/tscore/Diags.cc
index 2b9b09c367..14a1b3436e 100644
--- a/src/tscore/Diags.cc
+++ b/src/tscore/Diags.cc
@@ -336,7 +336,7 @@ Diags::tag_activated(const char *tag, DiagsTagType mode) 
const
 
   lock();
   if (activated_tags[mode]) {
-    activated = (activated_tags[mode]->match(tag) != -1);
+    activated = activated_tags[mode]->exec(tag, RE_ANCHORED);
   }
   unlock();
 
@@ -362,7 +362,7 @@ Diags::activate_taglist(const char *taglist, DiagsTagType 
mode)
     if (activated_tags[mode]) {
       delete activated_tags[mode];
     }
-    activated_tags[mode] = new DFA;
+    activated_tags[mode] = new Regex;
     activated_tags[mode]->compile(taglist);
     unlock();
   }

Reply via email to