svn commit: r233029 - stable/9/libexec/rtld-elf
Konstantin Belousov
kib at FreeBSD.org
Fri Mar 16 11:00:55 UTC 2012
Author: kib
Date: Fri Mar 16 11:00:55 2012
New Revision: 233029
URL: http://svn.freebsd.org/changeset/base/233029
Log:
MFC r232729:
Remove the use of toupper() from rtld_printf.c.
Modified:
stable/9/libexec/rtld-elf/rtld_printf.c
Directory Properties:
stable/9/libexec/rtld-elf/ (props changed)
Modified: stable/9/libexec/rtld-elf/rtld_printf.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld_printf.c Fri Mar 16 10:59:04 2012 (r233028)
+++ stable/9/libexec/rtld-elf/rtld_printf.c Fri Mar 16 11:00:55 2012 (r233029)
@@ -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_ar
}
}
-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
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;
More information about the svn-src-stable-9
mailing list