libutil: Add enreallocarray
This commit is contained in:
parent
5d49332d4f
commit
3fec3e2f4c
|
@ -40,11 +40,17 @@ reallocarray(void *optr, size_t nmemb, size_t size)
|
||||||
|
|
||||||
void *
|
void *
|
||||||
ereallocarray(void *optr, size_t nmemb, size_t size)
|
ereallocarray(void *optr, size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
return enreallocarray(1, optr, nmemb, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
enreallocarray(int status, void *optr, size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (!(p = reallocarray(optr, nmemb, size)))
|
if (!(p = reallocarray(optr, nmemb, size)))
|
||||||
eprintf("reallocarray: out of memory\n");
|
enprintf(status, "reallocarray: out of memory\n");
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
1
util.h
1
util.h
|
@ -32,6 +32,7 @@ char *estrndup(const char *, size_t);
|
||||||
void *encalloc(int, size_t, size_t);
|
void *encalloc(int, size_t, size_t);
|
||||||
void *enmalloc(int, size_t);
|
void *enmalloc(int, size_t);
|
||||||
void *enrealloc(int, void *, size_t);
|
void *enrealloc(int, void *, size_t);
|
||||||
|
void *enreallocarray(int, void *, size_t, size_t);
|
||||||
char *enstrdup(int, const char *);
|
char *enstrdup(int, const char *);
|
||||||
char *enstrndup(int, const char *, size_t);
|
char *enstrndup(int, const char *, size_t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user