summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-12-31 07:34:43 -0800
committerShawn O. Pearce <spearce@spearce.org>2008-12-31 07:34:43 -0800
commit5673434fff718d93ac738a03403442f16abeecba (patch)
tree5a408036aa992bffa67a0000ddd163e45be5f457 /src/util.h
parent7dd8a9f71052cc12f8dd9c1eec2e99afbf08df76 (diff)
downloadlibgit2-5673434fff718d93ac738a03403442f16abeecba.tar.gz
Undefine malloc,strdup,calloc before redefining them
Some systems may use cpp macros to define these functions, glibc appears to be one of them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index f09aecf46..f269af47f 100644
--- a/src/util.h
+++ b/src/util.h
@@ -9,8 +9,20 @@ extern char *git__strdup(const char *);
#ifndef GIT__NO_HIDE_MALLOC
# define GIT__FORBID_MALLOC do_not_use_malloc_directly
+
+# ifdef malloc
+# undef malloc
+# endif
# define malloc(a) GIT__FORBID_MALLOC
+
+# ifdef calloc
+# undef calloc
+# endif
# define calloc(a,b) GIT__FORBID_MALLOC
+
+# ifdef strdup
+# undef strdup
+# endif
# define strdup(a) GIT__FORBID_MALLOC
#endif