Convert codebase to use emalloc.c utility-functions
This also definitely increases readability and makes OOM-conditions more consistent.
This commit is contained in:
6
paste.c
6
paste.c
@@ -59,8 +59,7 @@ main(int argc, char *argv[])
|
||||
if (len == (size_t) - 1)
|
||||
eprintf("invalid delimiter\n");
|
||||
|
||||
if (!(delim = malloc((len + 1) * sizeof(*delim))))
|
||||
eprintf("out of memory\n");
|
||||
delim = emalloc((len + 1) * sizeof(*delim));
|
||||
|
||||
mbstowcs(delim, adelim, len);
|
||||
len = unescape(delim);
|
||||
@@ -68,8 +67,7 @@ main(int argc, char *argv[])
|
||||
eprintf("no delimiters specified\n");
|
||||
|
||||
/* populate file list */
|
||||
if (!(dsc = malloc(argc * sizeof(*dsc))))
|
||||
eprintf("out of memory\n");
|
||||
dsc = emalloc(argc * sizeof(*dsc));
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-") == 0)
|
||||
|
Reference in New Issue
Block a user