trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject trafficserver git commit: TS-3287: Remove superfluous NULL check
Date Wed, 04 Feb 2015 23:56:58 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 02ad412f5 -> 0296285e6


TS-3287: Remove superfluous NULL check

Coverity CID #1214714


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

Branch: refs/heads/master
Commit: 0296285e6ae4f3e31a804d861bb860c61f81503a
Parents: 02ad412
Author: Phil Sorber <sorber@apache.org>
Authored: Wed Feb 4 16:55:59 2015 -0700
Committer: Phil Sorber <sorber@apache.org>
Committed: Wed Feb 4 16:55:59 2015 -0700

----------------------------------------------------------------------
 plugins/experimental/url_sig/url_sig.c | 32 ++++++++++++++---------------
 1 file changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0296285e/plugins/experimental/url_sig/url_sig.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index 5dd5227..d0023fb 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -119,25 +119,23 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf,
int errbuf_s
       return TS_ERROR;
     }
     if (strncmp(line, "key", 3) == 0) {
-      if (value != NULL) {
-        if (strncmp((char *) (line + 3), "0", 1) == 0) {
-          keynum = 0;
-        } else {
-          TSDebug(PLUGIN_NAME, ">>> %s <<<", line + 3);
-          keynum = atoi((char *) (line + 3));
-          if (keynum == 0) {
-            keynum = -1;        // Not a Number
-          }
+      if (strncmp((char *) (line + 3), "0", 1) == 0) {
+        keynum = 0;
+      } else {
+        TSDebug(PLUGIN_NAME, ">>> %s <<<", line + 3);
+        keynum = atoi((char *) (line + 3));
+        if (keynum == 0) {
+          keynum = -1;        // Not a Number
         }
-        TSDebug(PLUGIN_NAME, "key number %d == %s", keynum, value);
-        if (keynum > MAX_KEY_NUM || keynum == -1) {
-          snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Key number (%d) >
MAX_KEY_NUM (%d) or NaN.", keynum,
-                   MAX_KEY_NUM);
-          fclose(file);
-          return TS_ERROR;
-        }
-        strcpy(&cfg->keys[keynum][0], value);
       }
+      TSDebug(PLUGIN_NAME, "key number %d == %s", keynum, value);
+      if (keynum > MAX_KEY_NUM || keynum == -1) {
+        snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Key number (%d) > MAX_KEY_NUM
(%d) or NaN.", keynum,
+                 MAX_KEY_NUM);
+        fclose(file);
+        return TS_ERROR;
+      }
+      strcpy(&cfg->keys[keynum][0], value);
     } else if (strncmp(line, "error_url", 9) == 0) {
       if (atoi(value)) {
         cfg->err_status = atoi(value);


Mime
View raw message