diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-01-26 12:53:23 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-01-26 12:53:23 +0100 |
| commit | 67d3daabae6fd00b40280662d4377b84ea849fca (patch) | |
| tree | e44cbfebf5420494c3333ba45f7e0db7b72f00f4 /src | |
| parent | Add blind-compress and blind-decompress (diff) | |
| download | blind-67d3daabae6fd00b40280662d4377b84ea849fca.tar.gz blind-67d3daabae6fd00b40280662d4377b84ea849fca.tar.bz2 blind-67d3daabae6fd00b40280662d4377b84ea849fca.tar.xz | |
Forgot to commit two files
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/emalloc.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/emalloc.h b/src/util/emalloc.h index 7c4266e..81816be 100644 --- a/src/util/emalloc.h +++ b/src/util/emalloc.h @@ -3,6 +3,7 @@ #define emalloc(...) enmalloc(1, __VA_ARGS__) #define ecalloc(...) encalloc(1, __VA_ARGS__) +#define erealloc(...) enrealloc(1, __VA_ARGS__) static inline void * enmalloc(int status, size_t n) @@ -18,6 +19,15 @@ encalloc(int status, size_t n, size_t m) { void *ptr = calloc(n, m); if (!ptr) - enprintf(status, "malloc: out of memory\n"); + enprintf(status, "calloc: out of memory\n"); + return ptr; +} + +static inline void * +enrealloc(int status, void *ptr, size_t n) +{ + ptr = realloc(ptr, n); + if (!ptr) + enprintf(status, "realloc: out of memory\n"); return ptr; } |
