#define reallocarray_(p, n, size) reallocarray(p, (n) ?: 1, (size) ?: 1)
-#define XREALLOC(p, n, T) exit_if_null(realloc_T(p, n, T))
+// xrealloc_T - exit-on-error realloc type-safe
+#define xrealloc_T(p, n, T) exit_if_null(realloc_T(p, n, T))
#endif // include guard
update_environ = (environ == newenvp);
- newenvp = XREALLOC(newenvp, newenvc + NEWENVP_STEP, char *);
+ newenvp = xrealloc_T(newenvp, newenvc + NEWENVP_STEP, char *);
/*
* If this is our current environment, update
while (true) {
int status;
LOOKUP_TYPE *resbuf = NULL;
- buffer = XREALLOC(buffer, length, char);
+ buffer = xrealloc_T(buffer, length, char);
status = REENTRANT_NAME(ARG_NAME, result, buffer,
length, &resbuf);
if ((0 == status) && (resbuf == result)) {
* If the group doesn't fit, I'll complain loudly and skip this
* part.
*/
- gids = XREALLOC(gids, ngroups + 1, gid_t);
+ gids = xrealloc_T(gids, ngroups + 1, gid_t);
LSEARCH(gid_t, &gid, gids, &ngroups);