diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-12 22:10:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-12 22:10:34 +0000 |
commit | 3a34d0c08a77ee48edc3f4353cc49b95aba85c2f (patch) | |
tree | 09708579e18a033c6722c5194c46116705f47b83 /libbb/xfuncs.c | |
parent | 21b080daa8c180a43d10d6b3dee47134ef21e581 (diff) | |
download | busybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.tar.gz busybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.tar.bz2 busybox-w32-3a34d0c08a77ee48edc3f4353cc49b95aba85c2f.zip |
random small size optimizations
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r-- | libbb/xfuncs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 827cbe870..207537929 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -333,6 +333,19 @@ char *itoa(int n) | |||
333 | return local_buf; | 333 | return local_buf; |
334 | } | 334 | } |
335 | 335 | ||
336 | // Emit a string of hex representation of bytes | ||
337 | char *bin2hex(char *p, const char *cp, int count) | ||
338 | { | ||
339 | while (count) { | ||
340 | unsigned char c = *cp++; | ||
341 | /* put lowercase hex digits */ | ||
342 | *p++ = 0x10 | bb_hexdigits_upcase[c >> 4]; | ||
343 | *p++ = 0x10 | bb_hexdigits_upcase[c & 0xf]; | ||
344 | count--; | ||
345 | } | ||
346 | return p; | ||
347 | } | ||
348 | |||
336 | // Die with an error message if we can't set gid. (Because resource limits may | 349 | // Die with an error message if we can't set gid. (Because resource limits may |
337 | // limit this user to a given number of processes, and if that fills up the | 350 | // limit this user to a given number of processes, and if that fills up the |
338 | // setgid() will fail and we'll _still_be_root_, which is bad.) | 351 | // setgid() will fail and we'll _still_be_root_, which is bad.) |