summaryrefslogtreecommitdiff
path: root/src/thread-utils.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-12-30 23:21:36 -0800
committerShawn O. Pearce <spearce@spearce.org>2008-12-30 23:28:30 -0800
commit64a47c01426a36cdb7e598d17018d5791e54bb97 (patch)
treec96d985df9957e7c042290d868d44feed8a4fc08 /src/thread-utils.c
parentffb55c532ccc1cb3c47eeeaac6c64240ab88fe29 (diff)
downloadlibgit2-64a47c01426a36cdb7e598d17018d5791e54bb97.tar.gz
Wrap malloc and friends and report out of memory as GIT_ENOMEM
We now forbid direct use of malloc, strdup or calloc within the library and instead use wrapper functions git__malloc, etc. to invoke the underlying library malloc and set git_errno to a no memory error code if the allocation fails. In the future once we have pack objects in memory we are likely to enhance these routines with garbage collection logic to purge cached pack data when allocations fail. Because the size of the function will grow somewhat large, we don't want to mark them for inline as gcc tends to aggressively inline, creating larger than expected executables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/thread-utils.c')
-rw-r--r--src/thread-utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/thread-utils.c b/src/thread-utils.c
index c945829d4..5e8220f46 100644
--- a/src/thread-utils.c
+++ b/src/thread-utils.c
@@ -1,3 +1,4 @@
+#include "common.h"
#include "thread-utils.h"
#ifdef _WIN32