summaryrefslogtreecommitdiff
path: root/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/trace.c b/trace.c
index 27fef868c4..7961a27a2e 100644
--- a/trace.c
+++ b/trace.c
@@ -26,14 +26,14 @@
#include "quote.h"
/* Stolen from "imap-send.c". */
-static int git_vasprintf(char **strp, const char *fmt, va_list ap)
+int nfvasprintf(char **strp, const char *fmt, va_list ap)
{
int len;
char tmp[1024];
if ((len = vsnprintf(tmp, sizeof(tmp), fmt, ap)) < 0 ||
!(*strp = xmalloc(len + 1)))
- return -1;
+ die("Fatal: Out of memory\n");
if (len >= (int)sizeof(tmp))
vsprintf(*strp, fmt, ap);
else
@@ -41,13 +41,15 @@ static int git_vasprintf(char **strp, const char *fmt, va_list ap)
return len;
}
-/* Stolen from "imap-send.c". */
-int nfvasprintf(char **str, const char *fmt, va_list va)
+int nfasprintf(char **str, const char *fmt, ...)
{
- int ret = git_vasprintf(str, fmt, va);
- if (ret < 0)
- die("Fatal: Out of memory\n");
- return ret;
+ int rc;
+ va_list args;
+
+ va_start(args, fmt);
+ rc = nfvasprintf(str, fmt, args);
+ va_end(args);
+ return rc;
}
/* Get a trace file descriptor from GIT_TRACE env variable. */