diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-12-12 21:00:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-12-12 21:00:10 +0000 |
commit | 20ebeea246c830665ba979899cf5d5966a95b38b (patch) | |
tree | 3438d870c9e6a17a4fe6751902e18aef4cdfe6ca | |
parent | afa668ba8c18366888ec9c2fb04caaa2e34a3f34 (diff) |
Add db_vprintf(), and then use it in ACPI's db_disprint() instead of
formatting into a local buffer.
ok miod@
-rw-r--r-- | sys/ddb/db_output.h | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpidebug.c | 7 | ||||
-rw-r--r-- | sys/kern/subr_prf.c | 19 |
3 files changed, 18 insertions, 12 deletions
diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index 039ed21ce79..86ca761acaa 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_output.h,v 1.15 2006/07/06 18:14:48 miod Exp $ */ +/* $OpenBSD: db_output.h,v 1.16 2013/12/12 21:00:09 guenther Exp $ */ /* $NetBSD: db_output.h,v 1.9 1996/04/04 05:13:50 cgd Exp $ */ /* @@ -38,6 +38,8 @@ void db_putchar(int); int db_print_position(void); int db_printf(const char *, ...) __attribute__((__format__(__kprintf__,1,2))); +int db_vprintf(const char *, va_list) + __attribute__((__format__(__kprintf__,1,0))); void db_end_line(int); /* diff --git a/sys/dev/acpi/acpidebug.c b/sys/dev/acpi/acpidebug.c index b728fc35553..0177ceab7f2 100644 --- a/sys/dev/acpi/acpidebug.c +++ b/sys/dev/acpi/acpidebug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidebug.c,v 1.28 2013/11/18 23:44:57 deraadt Exp $ */ +/* $OpenBSD: acpidebug.c,v 1.29 2013/12/12 21:00:09 guenther Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@openbsd.org> * @@ -298,13 +298,10 @@ db_acpi_showval(db_expr_t addr, int haddr, db_expr_t count, char *modif) void db_disprint(void *arg, const char *fmt, ...) { va_list ap; - char stre[64]; va_start(ap,fmt); - vsnprintf(stre, sizeof(stre), fmt, ap); + db_vprintf(fmt, ap); va_end(ap); - - db_printf("%s", stre); } void diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 8131fc95be8..7336d268f60 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.80 2013/11/25 00:33:21 djm Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.81 2013/12/12 21:00:09 guenther Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -477,17 +477,24 @@ int db_printf(const char *fmt, ...) { va_list ap; - int flags, retval; + int retval; - flags = TODDB; - if (db_log) - flags |= TOLOG; va_start(ap, fmt); - retval = kprintf(fmt, flags, NULL, NULL, ap); + retval = db_vprintf(fmt, ap); va_end(ap); return(retval); } +int +db_vprintf(const char *fmt, va_list ap) +{ + int flags; + + flags = TODDB; + if (db_log) + flags |= TOLOG; + return (kprintf(fmt, flags, NULL, NULL, ap)); +} #endif /* DDB */ |