You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2019/11/14 03:56:40 UTC

[trafficserver] branch 9.0.x updated: Fixes cppcheck issues for cookie_remap plugin

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

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new c6e9cc9  Fixes cppcheck issues for cookie_remap plugin
c6e9cc9 is described below

commit c6e9cc918eeafd7a450a3dda11ff80cce643bbf1
Author: Randall Meyer <rr...@apache.org>
AuthorDate: Thu Nov 14 10:21:46 2019 +0800

    Fixes cppcheck issues for cookie_remap plugin
    
    (cherry picked from commit e2c4d72b090d75c0f2ea5be6b6910d96cc9cb94e)
---
 plugins/experimental/cookie_remap/cookie_remap.cc | 3 ---
 plugins/experimental/cookie_remap/cookiejar.cc    | 5 ++---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/plugins/experimental/cookie_remap/cookie_remap.cc b/plugins/experimental/cookie_remap/cookie_remap.cc
index 9fb6991..421c52d 100644
--- a/plugins/experimental/cookie_remap/cookie_remap.cc
+++ b/plugins/experimental/cookie_remap/cookie_remap.cc
@@ -178,7 +178,6 @@ void
 urlencode(std::string &str)
 {
   size_t pos = 0;
-  std::string replacement;
   for (; pos < str.length(); pos++) {
     if (!isalnum(str[pos])) {
       char dec[2];
@@ -765,8 +764,6 @@ using OpMap = std::vector<StringPair>;
 static bool
 build_op(op &o, OpMap const &q)
 {
-  StringPair m;
-
   subop *sub = new subop();
 
   // loop through the array of key->value pairs
diff --git a/plugins/experimental/cookie_remap/cookiejar.cc b/plugins/experimental/cookie_remap/cookiejar.cc
index 0b3a05a..1f7d5d3 100644
--- a/plugins/experimental/cookie_remap/cookiejar.cc
+++ b/plugins/experimental/cookie_remap/cookiejar.cc
@@ -82,14 +82,13 @@ CookieJar::parse(const string &arg, const char *sepstr, bool val_check, bool mai
   cp           = arg_copy;
   char empty[] = "";
   for (key = strsep(&cp, sepstr); key != nullptr; key = strsep(&cp, sepstr)) {
-    int val_len;
     char *val   = strchr(key, '=');
     char *addme = nullptr;
 
     if (val) {
       /* split key and value */
-      *val++  = '\0';
-      val_len = strlen(val);
+      *val++      = '\0';
+      int val_len = strlen(val);
       if (val_len > 0) {
         /* if we have DQUOTES around our value then drop them */