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 __maybe_unused
,
11 int flag __maybe_unused
)
15 char *xstrdup(const char *str
)
17 char *ret
= strdup(str
);
19 release_pack_memory(strlen(str
) + 1, -1);
22 die("Out of memory, strdup failed");
27 void *xrealloc(void *ptr
, size_t size
)
29 void *ret
= realloc(ptr
, size
);
31 ret
= realloc(ptr
, 1);
33 release_pack_memory(size
, -1);
34 ret
= realloc(ptr
, size
);
36 ret
= realloc(ptr
, 1);
38 die("Out of memory, realloc failed");