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

6
grep.c
View File

@@ -111,10 +111,8 @@ addpattern(const char *pattern)
{
struct plist *pnode;
if (!(pnode = malloc(sizeof(*pnode))))
eprintf("malloc:");
if (!(pnode->pattern = strdup(pattern)))
eprintf("strdup:");
pnode = emalloc(sizeof(*pnode));
pnode->pattern = estrdup(pattern);
pnode->next = phead;
phead = pnode;
}