Convert codebase to use emalloc.c utility-functions

This also definitely increases readability and makes OOM-conditions
more consistent.
This commit is contained in:
FRIGN
2014-11-16 11:07:26 +01:00
committed by sin
parent 045fc62028
commit e17b9cdd0a
10 changed files with 22 additions and 36 deletions

5
tail.c
View File

@@ -75,8 +75,9 @@ taketail(FILE *fp, const char *str, long n)
long i, j;
size_t *size = NULL;
if (!(ring = calloc(n, sizeof *ring)) || !(size = calloc(n, sizeof *size)))
eprintf("calloc:");
ring = ecalloc(n, sizeof *ring);
size = ecalloc(n, sizeof *size);
for (i = j = 0; agetline(&ring[i], &size[i], fp) != -1; i = j = (i + 1) % n)
;
if (ferror(fp))