diff options
author | cem <cem@FreeBSD.org> | 2016-06-01 16:09:56 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-06-01 16:09:56 +0000 |
commit | d29b361251aaf275981b66d83ab2772d5def98b0 (patch) | |
tree | c0e65579bfa6d45a15cf69543e4c8c6408bf857e /lib/libthr/thread/thr_printf.c | |
parent | 18db3d0c115de478ad7684f9afba0ca2da68c96e (diff) | |
download | FreeBSD-src-d29b361251aaf275981b66d83ab2772d5def98b0.zip FreeBSD-src-d29b361251aaf275981b66d83ab2772d5def98b0.tar.gz |
libthr: Add vprintf variant of _thread_printf, formatted PANIC()
No ABI change.
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6672
Diffstat (limited to 'lib/libthr/thread/thr_printf.c')
-rw-r--r-- | lib/libthr/thread/thr_printf.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_printf.c b/lib/libthr/thread/thr_printf.c index ed94287..8e9a151 100644 --- a/lib/libthr/thread/thr_printf.c +++ b/lib/libthr/thread/thr_printf.c @@ -52,8 +52,17 @@ static void pstr(int fd, const char *s); void _thread_printf(int fd, const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + _thread_vprintf(fd, fmt, ap); + va_end(ap); +} + +void +_thread_vprintf(int fd, const char *fmt, va_list ap) +{ static const char digits[16] = "0123456789abcdef"; - va_list ap; char buf[20]; char *s; unsigned long r, u; @@ -61,13 +70,12 @@ _thread_printf(int fd, const char *fmt, ...) long d; int islong; - va_start(ap, fmt); while ((c = *fmt++)) { islong = 0; if (c == '%') { next: c = *fmt++; if (c == '\0') - goto out; + return; switch (c) { case 'c': pchar(fd, va_arg(ap, int)); @@ -111,8 +119,6 @@ next: c = *fmt++; } pchar(fd, c); } -out: - va_end(ap); } /* |