string_test: The dark side of coverity 13/17913/1
authorSteven Luong <sluong@cisco.com>
Wed, 27 Feb 2019 16:19:27 +0000 (08:19 -0800)
committerSteven Luong <sluong@cisco.com>
Wed, 27 Feb 2019 16:31:58 +0000 (08:31 -0800)
Me: "Mr Coverity, I thought I fixed the dead code warning just few days ago in
this file. Why are you still complaining about the same stuff to me?"

Mr. Coverity: "Duh! But you are supposed to fix all occurences in the same file."

Me: "Mr. Coverity, I didn't see you flag the warning in the other places last
time?"

Mr. Coverity: "Shh! That is the secret of my dark side!"

Change-Id: I565eccd90bf1bb39c9881664d361f83396ca8bcc
Signed-off-by: Steven Luong <sluong@cisco.com>
src/plugins/unittest/string_test.c

index 7e08bdf..5016a86 100644 (file)
@@ -442,8 +442,6 @@ test_clib_strncmp (vlib_main_t * vm, unformat_input_t * input)
   v_indicator = strncmp (s1, "Every moment is a fresh beginning", s1len);
   if (v_indicator != 0)
     return -1;
-  if (v_indicator != indicator)
-    return -1;
 
   /* s1 > s2, 0 is expected since comparison is no more than n character */
   indicator = clib_strncmp (s1, "Every moment is a fresh begin",
@@ -455,8 +453,6 @@ test_clib_strncmp (vlib_main_t * vm, unformat_input_t * input)
                         sizeof ("Every moment is a fresh begin") - 1);
   if (v_indicator != 0)
     return -1;
-  if (v_indicator != indicator)
-    return -1;
 
   /* s1 < s2, < 0 is expected */
   indicator = clib_strncmp (s1, "Every moment is fresh beginning",