From fa262cac766d383c51e0ead04c62e114a79bd738 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 8 Jul 2016 05:25:23 -0400 Subject: walker: let walker_say take arbitrary formats We take a printf-style format and a single "char *" parameter, and the format must therefore have at most one "%s" in it. Besides being error-prone (and tickling -Wformat-nonliteral), this is unnecessarily restrictive. We can just provide the usual varargs interface. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- walker.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'walker.c') diff --git a/walker.c b/walker.c index d95b007294..2c86e406f9 100644 --- a/walker.c +++ b/walker.c @@ -9,10 +9,14 @@ static unsigned char current_commit_sha1[20]; -void walker_say(struct walker *walker, const char *fmt, const char *hex) +void walker_say(struct walker *walker, const char *fmt, ...) { - if (walker->get_verbosely) - fprintf(stderr, fmt, hex); + if (walker->get_verbosely) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + } } static void report_missing(const struct object *obj) -- cgit v1.2.3