aboutsummaryrefslogtreecommitdiffstats
path: root/encalloc.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-08-28 13:23:45 +0200
committerMattias Andrée <maandree@kth.se>2018-08-28 13:24:00 +0200
commit34c0fd8f36269699b75e0aaf841911b5ae06246e (patch)
tree29cded18fde2cede51008b811713ef5c497f53db /encalloc.c
parentAdd tests for allocation functions (diff)
downloadlibsimple-34c0fd8f36269699b75e0aaf841911b5ae06246e.tar.gz
libsimple-34c0fd8f36269699b75e0aaf841911b5ae06246e.tar.bz2
libsimple-34c0fd8f36269699b75e0aaf841911b5ae06246e.tar.xz
Simplify en* functions, and handle argv0 == NULL correct
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'encalloc.c')
-rw-r--r--encalloc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/encalloc.c b/encalloc.c
index 1277d7b..de5a2c9 100644
--- a/encalloc.c
+++ b/encalloc.c
@@ -3,17 +3,12 @@
#ifndef TEST
-extern char *argv0;
-
-
void *
libsimple_encalloc(int status, size_t n, size_t m) /* TODO test */
{
void *ret = calloc(n, m);
- if (!ret) {
- fprintf(stderr, "%s: calloc: %s\n", argv0, strerror(errno));
- exit(status);
- }
+ if (!ret)
+ enprintf(status, "calloc:");
return ret;
}