Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2012 11:00:55 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r233029 - stable/9/libexec/rtld-elf
Message-ID:  <201203161100.q2GB0tD6014952@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203161100.q2GB0tD6014952>