]> The Tcpdump Group git mirrors - tcpdump/commitdiff
RESP: Remove an unnecessary test
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 6 Mar 2022 08:53:28 +0000 (09:53 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 6 Mar 2022 09:33:40 +0000 (10:33 +0100)
Moreover:
Remove an unneeded variable.

print-resp.c

index c5d67be40998cafd409ce9820f7f9bfe8a717060..37a386e3122c96f501266ef688a21beb75d1e180 100644 (file)
@@ -209,14 +209,12 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
 void
 resp_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
-    int ret_len = 0, length_cur = length;
+    int ret_len = 0;
 
     ndo->ndo_protocol = "resp";
-    if(!bp || length == 0)
-        return;
 
     ND_PRINT(": RESP");
-    while (length_cur > 0) {
+    while (length > 0) {
         /*
          * This block supports redis pipelining.
          * For example, multiple operations can be pipelined within the same string:
@@ -226,10 +224,10 @@ resp_print(netdissect_options *ndo, const u_char *bp, u_int length)
          * In order to handle this case, we must try and parse 'bp' until
          * 'length' bytes have been processed or we reach a trunc condition.
          */
-        ret_len = resp_parse(ndo, bp, length_cur);
+        ret_len = resp_parse(ndo, bp, length);
         TEST_RET_LEN_NORETURN(ret_len);
         bp += ret_len;
-        length_cur -= ret_len;
+        length -= ret_len;
     }
 
     return;