summaryrefslogtreecommitdiff
path: root/walker.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-07-08 09:25:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-08 17:11:23 (GMT)
commitfa262cac766d383c51e0ead04c62e114a79bd738 (patch)
tree2f70b803554a41d5eee0e2b5ee4f7bcd846e591e /walker.c
parent5c589a73de4394ad125a4effac227b3aec856fa1 (diff)
downloadgit-fa262cac766d383c51e0ead04c62e114a79bd738.zip
git-fa262cac766d383c51e0ead04c62e114a79bd738.tar.gz
git-fa262cac766d383c51e0ead04c62e114a79bd738.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'walker.c')
-rw-r--r--walker.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/walker.c b/walker.c
index d95b007..2c86e40 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)