summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 26db0f2)
raw | patch | inline | side by side (parent: 26db0f2)
author | Jeff King <peff@peff.net> | |
Thu, 24 Feb 2011 14:28:15 +0000 (09:28 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 8 Mar 2011 20:12:04 +0000 (12:12 -0800) |
This is a necessary cleanup to adding new types of trace
functions.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
functions.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
trace.c | patch | blob | history |
index 4a758babec4b53bf8b98572128c5bbf11019beb3..08b23b2ab96c1c20f90fbb03ad4d155b9a53bf88 100644 (file)
--- a/cache.h
+++ b/cache.h
/* trace.c */
__attribute__((format (printf, 1, 2)))
extern void trace_printf(const char *format, ...);
+extern void trace_vprintf(const char *format, va_list ap);
__attribute__((format (printf, 2, 3)))
extern void trace_argv_printf(const char **argv, const char *format, ...);
extern void trace_repo_setup(const char *prefix);
index eda3f6d721dc3c70a858eaa247a3100111324fb4..623e793e4f4a959252347c643c77747b04c80543 100644 (file)
--- a/trace.c
+++ b/trace.c
static const char err_msg[] = "Could not trace into fd given by "
"GIT_TRACE environment variable";
-void trace_printf(const char *fmt, ...)
+void trace_vprintf(const char *fmt, va_list ap)
{
struct strbuf buf = STRBUF_INIT;
- va_list ap;
int fd, need_close = 0;
fd = get_trace_fd(&need_close);
return;
set_try_to_free_routine(NULL); /* is never reset */
- va_start(ap, fmt);
strbuf_vaddf(&buf, fmt, ap);
- va_end(ap);
-
write_or_whine_pipe(fd, buf.buf, buf.len, err_msg);
strbuf_release(&buf);
close(fd);
}
+void trace_printf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ trace_vprintf(fmt, ap);
+ va_end(ap);
+}
+
void trace_argv_printf(const char **argv, const char *fmt, ...)
{
struct strbuf buf = STRBUF_INIT;