]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-resp.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-resp.c
index 38351e68d1e403b6013d757b97c198129b765241..37a386e3122c96f501266ef688a21beb75d1e180 100644 (file)
@@ -36,9 +36,6 @@
 #include "netdissect-stdinc.h"
 #include "netdissect.h"
 #include <limits.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
 
 #include "extract.h"
 
@@ -59,7 +56,6 @@
 #define resp_print_length_negative(ndo)  ND_PRINT(" length negative and not -1")
 #define resp_print_invalid(ndo)          ND_PRINT(" invalid")
 
-void       resp_print(netdissect_options *, const u_char *, u_int);
 static int resp_parse(netdissect_options *, const u_char *, int);
 static int resp_print_string_error_integer(netdissect_options *, const u_char *, int);
 static int resp_print_simple_string(netdissect_options *, const u_char *, int);
@@ -213,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:
@@ -230,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;