2 * Various trivial helper wrappers around standard functions
7 * There's no pack memory to release - but stay close to the Git
8 * version so wrap this away:
10 static inline void release_pack_memory(size_t size __used
, int flag __used
)
14 char *xstrdup(const char *str
)
16 char *ret
= strdup(str
);
18 release_pack_memory(strlen(str
) + 1, -1);
21 die("Out of memory, strdup failed");
26 void *xrealloc(void *ptr
, size_t size
)
28 void *ret
= realloc(ptr
, size
);
30 ret
= realloc(ptr
, 1);
32 release_pack_memory(size
, -1);
33 ret
= realloc(ptr
, size
);
35 ret
= realloc(ptr
, 1);
37 die("Out of memory, realloc failed");