use helpers from c.h
A few files still use the C library helpers from err.h, so migrate them to the local c.h helpers. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
committed by
Sami Kerola
parent
13d8cc0681
commit
afaf698896
@@ -24,7 +24,7 @@ void *xmalloc(const size_t size)
|
||||
{
|
||||
void *ret = malloc(size);
|
||||
if (!ret && size)
|
||||
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void *xrealloc(void *ptr, const size_t size)
|
||||
{
|
||||
void *ret = realloc(ptr, size);
|
||||
if (!ret && size)
|
||||
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void *xcalloc(const size_t nelems, const size_t size)
|
||||
{
|
||||
void *ret = calloc(nelems, size);
|
||||
if (!ret && size && nelems)
|
||||
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ static inline char *xstrdup(const char *str)
|
||||
return NULL;
|
||||
ret = strdup(str);
|
||||
if (!ret)
|
||||
err(XALLOC_EXIT_CODE, "cannot duplicate string");
|
||||
xerrx(XALLOC_EXIT_CODE, "cannot duplicate string");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user