summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-12-23 00:15:09 +0200
committerVicent Marti <tanoku@gmail.com>2010-12-23 00:15:09 +0200
commit9f54fe482dd369ebbae67b0b33f7efde206ba249 (patch)
tree5b239e63f5040ebece759c5143ea44916d17bb63 /src/util.h
parent11f6646f032c669170453e8e359ac337fa9abbb7 (diff)
downloadlibgit2-9f54fe482dd369ebbae67b0b33f7efde206ba249.tar.gz
Remove git_errno
It was not being used by any methods (only by malloc and calloc), and since it needs to be TLS, it cannot be exported on DLLs on Windows. Burn it with fire. The API always returns error codes! Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/util.h b/src/util.h
index 05f5a3443..5204185b9 100644
--- a/src/util.h
+++ b/src/util.h
@@ -3,28 +3,16 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-GIT_EXTERN(void *) git__malloc(size_t);
-GIT_EXTERN(void *) git__calloc(size_t, size_t);
-GIT_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
+/*
+ * Don't wrap malloc/calloc.
+ * Use the default versions in glibc, and make
+ * sure that any methods that allocate memory
+ * return a GIT_ENOMEM error when allocation
+ * fails.
+ */
+#define git__malloc malloc
+#define git__calloc calloc
+#define git__strdup strdup
GIT_EXTERN(int) git__fmt(char *, size_t, const char *, ...)
GIT_FORMAT_PRINTF(3, 4);