Repository: trafficserver
Updated Branches:
  refs/heads/master ff2c28f02 -> 4ef8d3914


Remove redundant WKS checks

This code fools gcc 4.8.2 into thinking token_info is used
uninitialized. Just remove the unnecessary check.


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

Branch: refs/heads/master
Commit: 4ef8d3914b35a57a0ab1971368f213fe8cad20b9
Parents: ff2c28f
Author: James Peach <[email protected]>
Authored: Tue Oct 28 12:13:09 2014 -0700
Committer: James Peach <[email protected]>
Committed: Tue Oct 28 12:14:38 2014 -0700

----------------------------------------------------------------------
 proxy/hdrs/MIME.cc | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4ef8d391/proxy/hdrs/MIME.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc
index eded04d..69acaa6 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -1281,8 +1281,8 @@ _mime_hdr_field_list_search_by_slotnum(MIMEHdrImpl *mh, 
int slotnum)
 MIMEField *
 mime_hdr_field_find(MIMEHdrImpl *mh, const char *field_name_str, int 
field_name_len)
 {
-  int is_wks;
   HdrTokenHeapPrefix *token_info;
+  const bool is_wks = hdrtoken_is_wks(field_name_str);
 
   ink_assert(field_name_len >= 0);
 
@@ -1290,7 +1290,6 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char 
*field_name_str, int field_name_
   // do presence check and slot accelerator //
   ////////////////////////////////////////////
 
-  is_wks = hdrtoken_is_wks(field_name_str);
 #if TRACK_FIELD_FIND_CALLS
   Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): is_wks = %d\n", 
mh, field_name_len, field_name_str, is_wks);
 #endif
@@ -1325,12 +1324,11 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char 
*field_name_str, int field_name_
 #endif
       }
     }
-  }
-  ///////////////////////////////////////////////////////////////////////////
-  // search by well-known string index or by case-insensitive string match //
-  ///////////////////////////////////////////////////////////////////////////
 
-  if (is_wks) {
+    ///////////////////////////////////////////////////////////////////////////
+    // search by well-known string index or by case-insensitive string match //
+    ///////////////////////////////////////////////////////////////////////////
+
     MIMEField *f = _mime_hdr_field_list_search_by_wks(mh, token_info->wks_idx);
     ink_assert((f == NULL) || f->is_live());
 #if TRACK_FIELD_FIND_CALLS

Reply via email to