aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-03-09 16:21:40 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-03-09 16:21:40 +0000
commit5983b87199bb61cab7978c8af191653739ff53f5 (patch)
treefaa1511811f184f6d5dafa2f1220f2fa1e1ebb8e /libexec
parent0518af3e087f2477da6890a7edc8940c73907877 (diff)
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld_printf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c
index b9aadc3587b00..eb4514a3902bb 100644
--- a/libexec/rtld-elf/rtld_printf.c
+++ b/libexec/rtld-elf/rtld_printf.c
@@ -36,7 +36,6 @@
*/
#include <sys/param.h>
-#include <ctype.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stddef.h>
@@ -90,8 +89,10 @@ snprintf_func(int ch, struct snprintf_arg *const info)
}
}
-static char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-#define hex2ascii(hex) (hex2ascii_data[hex])
+static char const hex2ascii_lower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+static char const hex2ascii_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+#define hex2ascii(hex) (hex2ascii_lower[hex])
+#define hex2ascii_upper(hex) (hex2ascii_upper[hex])
static __inline int
imax(int a, int b)
@@ -108,8 +109,9 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper)
p = nbuf;
*p = '\0';
do {
- c = hex2ascii(num % base);
- *++p = upper ? toupper(c) : c;
+ c = upper ? hex2ascii_upper(num % base) :
+ hex2ascii(num % base);
+ *++p = c;
} while (num /= base);
if (lenp)
*lenp = p - nbuf;