trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [3/7] trafficserver git commit: header_rewrite: remove static hook names array
Date Fri, 02 Jan 2015 21:08:57 GMT
header_rewrite: remove static hook names array

Coverity CID #1254807
Coverity CID #1254799
Coverity CID #1254821


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c69a1b55
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c69a1b55
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c69a1b55

Branch: refs/heads/master
Commit: c69a1b55501ef2e9d2d02fabbbf46043c01bba01
Parents: 325d1de
Author: James Peach <jpeach@apache.org>
Authored: Mon Dec 29 12:14:17 2014 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Fri Jan 2 12:45:51 2015 -0800

----------------------------------------------------------------------
 plugins/header_rewrite/header_rewrite.cc | 30 ++++-----------------------
 plugins/header_rewrite/resources.cc      |  6 +-----
 2 files changed, 5 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c69a1b55/plugins/header_rewrite/header_rewrite.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/header_rewrite.cc b/plugins/header_rewrite/header_rewrite.cc
index 1202545..a97b8ab 100644
--- a/plugins/header_rewrite/header_rewrite.cc
+++ b/plugins/header_rewrite/header_rewrite.cc
@@ -29,28 +29,6 @@
 const char PLUGIN_NAME[] = "header_rewrite";
 const char PLUGIN_NAME_DBG[] = "dbg_header_rewrite";
 
-const char* HOOK_NAMES[] = {
-  "TS_HTTP_READ_REQUEST_HDR_HOOK",
-  "TS_HTTP_OS_DNS_HOOK",
-  "TS_HTTP_SEND_REQUEST_HDR_HOOK",
-  "TS_HTTP_READ_CACHE_HDR_HOOK",
-  "TS_HTTP_READ_RESPONSE_HDR_HOOK",
-  "TS_HTTP_SEND_RESPONSE_HDR_HOOK",
-  "TS_HTTP_REQUEST_TRANSFORM_HOOK",
-  "TS_HTTP_RESPONSE_TRANSFORM_HOOK",
-  "TS_HTTP_SELECT_ALT_HOOK",
-  "TS_HTTP_TXN_START_HOOK",
-  "TS_HTTP_TXN_CLOSE_HOOK",
-  "TS_HTTP_SSN_START_HOOK",
-  "TS_HTTP_SSN_CLOSE_HOOK",
-  "TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK",
-  "TS_HTTP_PRE_REMAP_HOOK",
-  "TS_HTTP_POST_REMAP_HOOK",
-  "TS_HTTP_RESPONSE_CLIENT_HOOK",
-  "TS_HTTP_LAST_HOOK"
-};
-
-
 // Forward declaration for the main continuation.
 static int cont_rewrite_headers(TSCont, TSEvent, void *);
 
@@ -98,7 +76,7 @@ bool
 RulesConfig::add_rule(RuleSet* rule)
 {
   if (rule && rule->has_operator()) {
-    TSDebug(PLUGIN_NAME_DBG, "   Adding rule to hook=%s\n", HOOK_NAMES[rule->get_hook()]);
+    TSDebug(PLUGIN_NAME_DBG, "   Adding rule to hook=%s\n", TSHttpHookNameLookup(rule->get_hook()));
     if (NULL == _rules[rule->get_hook()]) {
       _rules[rule->get_hook()] = rule;
     } else {
@@ -317,7 +295,7 @@ TSPluginInit(int argc, const char *argv[])
 
     for (int i=TS_HTTP_READ_REQUEST_HDR_HOOK; i<TS_HTTP_LAST_HOOK; ++i) {
       if (conf->rule(i)) {
-        TSDebug(PLUGIN_NAME, "Adding global ruleset to hook=%s", HOOK_NAMES[i]);
+        TSDebug(PLUGIN_NAME, "Adding global ruleset to hook=%s", TSHttpHookNameLookup((TSHttpHookID)i));
         TSHttpHookAdd(static_cast<TSHttpHookID>(i), contp);
       }
     }
@@ -382,7 +360,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf
ATS_UNUSE
   if (TSIsDebugTagSet(PLUGIN_NAME)) {
     for (int i=TS_HTTP_READ_REQUEST_HDR_HOOK; i<TS_HTTP_LAST_HOOK; ++i) {
       if (conf->rule(i)) {
-        TSDebug(PLUGIN_NAME, "Adding remap ruleset to hook=%s", HOOK_NAMES[i]);
+        TSDebug(PLUGIN_NAME, "Adding remap ruleset to hook=%s", TSHttpHookNameLookup((TSHttpHookID)i));
       }
     }
   }
@@ -420,7 +398,7 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
   for (int i=TS_HTTP_READ_REQUEST_HDR_HOOK; i<TS_HTTP_LAST_HOOK; ++i) {
     if (conf->rule(i)) {
       TSHttpTxnHookAdd(rh, static_cast<TSHttpHookID>(i), conf->continuation());
-      TSDebug(PLUGIN_NAME, "Added remapped TXN hook=%s", HOOK_NAMES[i]);
+      TSDebug(PLUGIN_NAME, "Added remapped TXN hook=%s", TSHttpHookNameLookup((TSHttpHookID)i));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c69a1b55/plugins/header_rewrite/resources.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/resources.cc b/plugins/header_rewrite/resources.cc
index 8e34d3b..a1992ca 100644
--- a/plugins/header_rewrite/resources.cc
+++ b/plugins/header_rewrite/resources.cc
@@ -24,15 +24,11 @@
 #include "resources.h"
 #include "lulu.h"
 
-// This is defined in header_rewrite.cc, used here for debugging
-extern char* HOOK_NAMES[];
-
-
 // Collect all resources
 void
 Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
 {
-  TSDebug(PLUGIN_NAME, "Building resources, hook=%s", HOOK_NAMES[hook]);
+  TSDebug(PLUGIN_NAME, "Building resources, hook=%s", TSHttpHookNameLookup(hook));
 
   // If we need the client request headers, make sure it's also available in the client vars.
   if (ids & RSRC_CLIENT_REQUEST_HEADERS) {


Mime
View raw message