From 851c34b04e0ce866e15c28e144986eca7533a6f4 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 8 May 2010 17:13:49 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- wrapper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'wrapper.c') diff --git a/wrapper.c b/wrapper.c index 62edb57338..8aa9df9b83 100644 --- a/wrapper.c +++ b/wrapper.c @@ -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) -- cgit 1.2.3-korg