]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_string: simplify hex output routine
authorJan Engelhardt <jengelh@medozas.de>
Sun, 21 Aug 2011 11:16:16 +0000 (13:16 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 25 Aug 2011 10:04:23 +0000 (12:04 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_string.c

index 257f5f8535ab0cb12601bc05b2a03654bbdf4060..365019f736fec0085dd5d59fcf37a81dee09fc76 100644 (file)
@@ -230,13 +230,8 @@ print_hex_string(const char *str, const unsigned short int len)
        unsigned int i;
        /* start hex block */
        printf(" \"|");
-       for (i=0; i < len; i++) {
-               /* see if we need to prepend a zero */
-               if ((unsigned char) str[i] <= 0x0F)
-                       printf("0%x", (unsigned char) str[i]);
-               else
-                       printf("%x", (unsigned char) str[i]);
-       }
+       for (i=0; i < len; i++)
+               printf("%02x", (unsigned char)str[i]);
        /* close hex block */
        printf("|\"");
 }