summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9374919)
raw | patch | inline | side by side (parent: 9374919)
author | Johannes Sixt <j6t@kdbg.org> | |
Sat, 8 May 2010 15:13:49 +0000 (17:13 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 9 May 2010 05:27:54 +0000 (22:27 -0700) |
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>
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>
builtin-pack-objects.c | patch | blob | history | |
git-compat-util.h | patch | blob | history | |
wrapper.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 26fc7cd5a6f89ce8d8d8c3c56ff039c108ef12f1..5279cd99f2f9ab9ccff38745a844c1961e0beb52 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
read_unlock();
}
+try_to_free_t old_try_to_free_routine;
+
/*
* The main thread waits on the condition that (at least) one of the workers
* has stopped working (which is indicated in the .working member of
pthread_mutex_init(&cache_mutex, NULL);
pthread_mutex_init(&progress_mutex, NULL);
pthread_cond_init(&progress_cond, NULL);
- set_try_to_free_routine(try_to_free_from_threads);
+ old_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads);
}
static void cleanup_threaded_search(void)
{
- set_try_to_free_routine(NULL);
+ set_try_to_free_routine(old_try_to_free_routine);
pthread_cond_destroy(&progress_cond);
pthread_mutex_destroy(&read_mutex);
pthread_mutex_destroy(&cache_mutex);
diff --git a/git-compat-util.h b/git-compat-util.h
index 1c171db8b1fb46c5230280b0ebd872c8f23cf7c0..828aadaf3ae0bdd41ed3d2966ab36c5a73ca91ab 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
extern void release_pack_memory(size_t, int);
-extern void set_try_to_free_routine(void (*routine)(size_t));
+typedef void (*try_to_free_t)(size_t);
+extern try_to_free_t set_try_to_free_routine(try_to_free_t);
extern char *xstrdup(const char *str);
extern void *xmalloc(size_t size);
diff --git a/wrapper.c b/wrapper.c
index 62edb57338ccd1ae56b86649ec07d88c251576da..8aa9df9b83baddc4a06bbe9e0e5839111edfb29f 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
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)