make use of en*alloc functions

This commit is contained in:
Jakob Kramer
2015-02-11 02:08:17 +01:00
committed by sin
parent c0a3c66a84
commit 0fcad66c75
3 changed files with 8 additions and 25 deletions

9
sort.c
View File

@@ -131,9 +131,7 @@ addkeydef(char *def, int flags)
{
struct kdlist *node;
node = malloc(sizeof(*node));
if (!node)
enprintf(2, "malloc:");
node = enmalloc(2, sizeof(*node));
if (!head)
head = node;
if (parse_keydef(&node->keydef, def, flags))
@@ -282,7 +280,6 @@ static char *
columns(char *line, const struct keydef *kd)
{
char *start, *end;
char *res;
int i;
for (i = 1, start = line; i < kd->start_column; i++)
@@ -305,7 +302,5 @@ columns(char *line, const struct keydef *kd)
end = strchr(line, '\0');
}
if (!(res = strndup(start, end - start)))
enprintf(2, "strndup:");
return res;
return enstrndup(2, start, end - start);
}