summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6068ac8)
raw | patch | inline | side by side (parent: 6068ac8)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 21 Dec 2010 17:24:18 +0000 (09:24 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 21 Dec 2010 17:25:14 +0000 (09:25 -0800) |
This way, the next caller that wants to disable our memory reclamation
machinery does not have to define its own do_nothing() stub.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
machinery does not have to define its own do_nothing() stub.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
trace.c | patch | blob | history | |
wrapper.c | patch | blob | history |
index 62586fa371b22e9b0b2d8f4e7eb9a4e3e100ac9f..0fb2a2c64b63ab0067edff124b8f3d2c7175c70e 100644 (file)
--- a/trace.c
+++ b/trace.c
#include "cache.h"
#include "quote.h"
-static void do_nothing(size_t unused)
-{
-}
-
/* Get a trace file descriptor from GIT_TRACE env variable. */
static int get_trace_fd(int *need_close)
{
if (!fd)
return;
- set_try_to_free_routine(do_nothing); /* is never reset */
+ set_try_to_free_routine(NULL); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
if (!fd)
return;
- set_try_to_free_routine(do_nothing); /* is never reset */
+ set_try_to_free_routine(NULL); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
diff --git a/wrapper.c b/wrapper.c
index 4c1639f1536d259a2b64d574005ac973d042b273..8d7dd31c4ba5439652d11e5ada06e0d52bc04e4f 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
try_to_free_t set_try_to_free_routine(try_to_free_t routine)
{
try_to_free_t old = try_to_free_routine;
+ if (!routine)
+ routine = do_nothing;
try_to_free_routine = routine;
return old;
}