From e0500293852910c2f44fce61e7eb856adbc20d8a Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 6 Nov 2010 14:00:38 -0500 Subject: Remove pack file handling dependency from wrapper.o MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As v1.7.0-rc0~43 (slim down "git show-index", 2010-01-21) explains, use of xmalloc() brings in a dependency on zlib, the sha1 lib, and the rest of git's object file access machinery via try_to_free_pack_memory. That is overkill when xmalloc is just being used as a convenience wrapper to exit when no memory is available. So defer setting try_to_free_pack_memory as try_to_free_routine until the first packfile is opened in add_packed_git(). After this change, a simple program using xmalloc() and no other functions will not pull in any code from libgit.a aside from wrapper.o and usage.o. Improved-by: René Scharfe Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- wrapper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'wrapper.c') diff --git a/wrapper.c b/wrapper.c index 185dfbcc46..4c1639f153 100644 --- a/wrapper.c +++ b/wrapper.c @@ -3,12 +3,11 @@ */ #include "cache.h" -static void try_to_free_builtin(size_t size) +static void do_nothing(size_t size) { - release_pack_memory(size, -1); } -static void (*try_to_free_routine)(size_t size) = try_to_free_builtin; +static void (*try_to_free_routine)(size_t size) = do_nothing; try_to_free_t set_try_to_free_routine(try_to_free_t routine) { -- cgit v1.3