diff options
| author | Vicent Marti <tanoku@gmail.com> | 2010-12-23 00:15:09 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2010-12-23 00:15:09 +0200 |
| commit | 9f54fe482dd369ebbae67b0b33f7efde206ba249 (patch) | |
| tree | 5b239e63f5040ebece759c5143ea44916d17bb63 /src/util.h | |
| parent | 11f6646f032c669170453e8e359ac337fa9abbb7 (diff) | |
| download | libgit2-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.h | 32 |
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); |
