netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/5] libxt_string: simplify hex output routine
Date: Fri, 26 Aug 2011 15:15:11 +0200	[thread overview]
Message-ID: <1314364516-7875-2-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1314364516-7875-1-git-send-email-jengelh@medozas.de>

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 extensions/libxt_string.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c
index 257f5f8..365019f 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("|\"");
 }
-- 
1.7.3.4


  reply	other threads:[~2011-08-26 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 13:15 iptables fixes 2011-08-26 Jan Engelhardt
2011-08-26 13:15 ` Jan Engelhardt [this message]
2011-08-26 13:15 ` [PATCH 2/5] libxt_string: replace hex codes by char equivalents Jan Engelhardt
2011-08-26 13:15 ` [PATCH 3/5] src: remove unused IPTABLES_MULTI define Jan Engelhardt
2011-08-26 13:15 ` [PATCH 4/5] libxt_string: escape the escaping char too Jan Engelhardt
2011-08-26 13:15 ` [PATCH 5/5] libxt_TOS: update linux kernel version list for backported fix Jan Engelhardt
2011-08-29 20:44 ` iptables fixes 2011-08-26 Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314364516-7875-2-git-send-email-jengelh@medozas.de \
    --to=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).