From: Jan Engelhardt Date: Sun, 21 Aug 2011 11:16:16 +0000 (+0200) Subject: libxt_string: simplify hex output routine X-Git-Tag: v1.4.12.1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=131d4fb53b45be85b1315f72f958cadf7b24a63f;p=thirdparty%2Fiptables.git libxt_string: simplify hex output routine Signed-off-by: Jan Engelhardt --- diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c index 257f5f85..365019f7 100644 --- a/extensions/libxt_string.c +++ b/extensions/libxt_string.c @@ -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("|\""); }