trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [1/2] git commit: TS-2891: Optimiize if block for status code
Date Wed, 18 Jun 2014 22:13:39 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 58ca65e1c -> eab97f120


TS-2891: Optimiize if block for status code


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

Branch: refs/heads/master
Commit: d3879b03fdb5ff27685a004413b28f744e587a8a
Parents: 58ca65e
Author: Justin Laue <justin@fp-x.com>
Authored: Wed Jun 18 15:59:58 2014 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Wed Jun 18 15:59:58 2014 -0600

----------------------------------------------------------------------
 plugins/experimental/remap_stats/remap_stats.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3879b03/plugins/experimental/remap_stats/remap_stats.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/remap_stats/remap_stats.c b/plugins/experimental/remap_stats/remap_stats.c
index 427021c..f0fe80f 100644
--- a/plugins/experimental/remap_stats/remap_stats.c
+++ b/plugins/experimental/remap_stats/remap_stats.c
@@ -204,13 +204,15 @@ handle_txn_close(TSCont cont, TSEvent event ATS_UNUSED, void *edata)
                 status_code = TSHttpHdrStatusGet(buf, hdr_loc);
                 TSHandleMLocRelease(buf, TS_NULL_MLOC, hdr_loc);
 
-                if ((status_code >= 200) && (status_code <= 299))
+                if (status_code < 200)
+                    CREATE_STAT_NAME(stat_name, remap, "status_other")
+                else if (status_code <= 299)
                     CREATE_STAT_NAME(stat_name, remap, "status_2xx")
-                else if ((status_code >= 300) && (status_code <= 399))
+                else if (status_code <= 399)
                     CREATE_STAT_NAME(stat_name, remap, "status_3xx")
-                else if ((status_code >= 400) && (status_code <= 499))
+                else if (status_code <= 499)
                     CREATE_STAT_NAME(stat_name, remap, "status_4xx")
-                else if ((status_code >= 500) && ((int)status_code <= 599))
+                else if (status_code <= 599)
                     CREATE_STAT_NAME(stat_name, remap, "status_5xx")
                 else
                     CREATE_STAT_NAME(stat_name, remap, "status_other")


Mime
View raw message