diff options
author | Johannes Sixt <j6t@kdbg.org> | 2010-05-08 17:13:49 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-08 22:27:54 -0700 |
commit | 851c34b04e0ce866e15c28e144986eca7533a6f4 (patch) | |
tree | f0c79c6963ecc08c4ab1d76a08156bcd2bfc39f5 /wrapper.c | |
parent | 937491944292fa3303b565b9bd8914c6b644ab13 (diff) | |
download | git-851c34b04e0ce866e15c28e144986eca7533a6f4.tar.gz |
Have set_try_to_free_routine return the previous routine
This effectively requires from the callers of set_try_to_free_routine to
treat the try-to-free-routines as a stack.
We will need this for the next patch where the only current caller cannot
depend on that the previously set routine was the default routine.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
-rw-r--r-- | wrapper.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -10,9 +10,11 @@ static void try_to_free_builtin(size_t size) static void (*try_to_free_routine)(size_t size) = try_to_free_builtin; -void set_try_to_free_routine(void (*routine)(size_t)) +try_to_free_t set_try_to_free_routine(try_to_free_t routine) { - try_to_free_routine = (routine) ? routine : try_to_free_builtin; + try_to_free_t old = try_to_free_routine; + try_to_free_routine = routine; + return old; } char *xstrdup(const char *str) |