From 9483c94352b0182580972e7cac2ba585022398d5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Jul 2008 00:46:00 +0000 Subject: Cleaner to not vsprintf() at all if `format' is NULL. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@17 abc39116-655e-4be6-ad55-d661dc543056 --- catsprintf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'catsprintf.c') diff --git a/catsprintf.c b/catsprintf.c index e914e6d..d9d73ff 100644 --- a/catsprintf.c +++ b/catsprintf.c @@ -1,3 +1,4 @@ +#include #include "catsprintf.h" static const int map_maj[] = { @@ -65,7 +66,9 @@ dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) o->id = code; o->major = (dmi_codes_major *)&dmiCodesMajor[map_maj[code>>8]]; o->key = (char *)key; - vsprintf(o->value, format, arg); + if (format != NULL) + vsprintf(o->value, format, arg); + o->next = last; va_end(arg); /* cleanup */ -- cgit