diff options
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -147,4 +147,20 @@ extern void *read_tree_with_tree_or_commit_sha1(const unsigned char *sha1, unsigned long *size, unsigned char *tree_sha1_ret); +static inline void *xmalloc(int size) +{ + void *ret = malloc(size); + if (!ret) + die("Out of memory, malloc failed"); + return ret; +} + +static inline void *xrealloc(void *ptr, int size) +{ + void *ret = realloc(ptr, size); + if (!ret) + die("Out of memory, realloc failed"); + return ret; +} + #endif /* CACHE_H */ |