From 3a34d0c08a77ee48edc3f4353cc49b95aba85c2f Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 12 Jan 2007 22:10:34 +0000 Subject: random small size optimizations --- libbb/xfuncs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libbb/xfuncs.c') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 827cbe8..2075379 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -333,6 +333,19 @@ char *itoa(int n) return local_buf; } +// Emit a string of hex representation of bytes +char *bin2hex(char *p, const char *cp, int count) +{ + while (count) { + unsigned char c = *cp++; + /* put lowercase hex digits */ + *p++ = 0x10 | bb_hexdigits_upcase[c >> 4]; + *p++ = 0x10 | bb_hexdigits_upcase[c & 0xf]; + count--; + } + return p; +} + // Die with an error message if we can't set gid. (Because resource limits may // limit this user to a given number of processes, and if that fills up the // setgid() will fail and we'll _still_be_root_, which is bad.) -- cgit v1.1