summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-27 13:28:54 +0000
committered <ed@FreeBSD.org>2009-02-27 13:28:54 +0000
commitf02ef8e872244e98e3caa4724a632319c7f5132a (patch)
tree828525320556a9982ee564afa514f2e537c39051
parent710220924b908b4095930e1c54128eab523f21e7 (diff)
downloadFreeBSD-src-f02ef8e872244e98e3caa4724a632319c7f5132a.zip
FreeBSD-src-f02ef8e872244e98e3caa4724a632319c7f5132a.tar.gz
Remove redundant code in printf() and vprintf().
printf() and vprintf() are exactly the same, except the way arguments are passed. Just like we see in other pieces of code (i.e. libc's printf()), implement printf() using vprintf(). Submitted by: Christoph Mallon <christoph mallon gmx de>
-rw-r--r--sys/kern/subr_prf.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index c311120..5c34f40 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -295,39 +295,12 @@ int
printf(const char *fmt, ...)
{
va_list ap;
- struct putchar_arg pca;
int retval;
-#ifdef PRINTF_BUFR_SIZE
- char bufr[PRINTF_BUFR_SIZE];
-#endif
va_start(ap, fmt);
- pca.tty = NULL;
- pca.flags = TOCONS | TOLOG;
- pca.pri = -1;
-#ifdef PRINTF_BUFR_SIZE
- pca.p_bufr = bufr;
- pca.p_next = pca.p_bufr;
- pca.n_bufr = sizeof(bufr);
- pca.remain = sizeof(bufr);
- *pca.p_next = '\0';
-#else
- /* Don't buffer console output. */
- pca.p_bufr = NULL;
-#endif
-
- retval = kvprintf(fmt, putchar, &pca, 10, ap);
+ retval = vprintf(fmt, ap);
va_end(ap);
-#ifdef PRINTF_BUFR_SIZE
- /* Write any buffered console output: */
- if (*pca.p_bufr != '\0')
- cnputs(pca.p_bufr);
-#endif
-
- if (!panicstr)
- msgbuftrigger = 1;
-
return (retval);
}
OpenPOWER on IntegriCloud