svn commit: r301135 - head/lib/libthr/thread
Conrad E. Meyer
cem at FreeBSD.org
Wed Jun 1 16:11:10 UTC 2016
Author: cem
Date: Wed Jun 1 16:11:09 2016
New Revision: 301135
URL: https://svnweb.freebsd.org/changeset/base/301135
Log:
libthr: _thread_vprintf: Enhance support for %p, %#x
No functional change. No ABI change.
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6672
Modified:
head/lib/libthr/thread/thr_printf.c
Modified: head/lib/libthr/thread/thr_printf.c
==============================================================================
--- head/lib/libthr/thread/thr_printf.c Wed Jun 1 16:09:56 2016 (r301134)
+++ head/lib/libthr/thread/thr_printf.c Wed Jun 1 16:11:09 2016 (r301135)
@@ -68,15 +68,19 @@ _thread_vprintf(int fd, const char *fmt,
unsigned long r, u;
int c;
long d;
- int islong;
+ int islong, isalt;
while ((c = *fmt++)) {
+ isalt = 0;
islong = 0;
if (c == '%') {
next: c = *fmt++;
if (c == '\0')
return;
switch (c) {
+ case '#':
+ isalt = 1;
+ goto next;
case 'c':
pchar(fd, va_arg(ap, int));
continue;
@@ -87,10 +91,13 @@ next: c = *fmt++;
islong = 1;
goto next;
case 'p':
+ pstr(fd, "0x");
islong = 1;
case 'd':
case 'u':
case 'x':
+ if (c == 'x' && isalt)
+ pstr(fd, "0x");
r = ((c == 'u') || (c == 'd')) ? 10 : 16;
if (c == 'd') {
if (islong)
More information about the svn-src-head
mailing list