Remove mallocarray(...) and use reallocarray(NULL, ...)
After a short correspondence with Otto Moerbeek it turned out mallocarray() is only in the OpenBSD-Kernel, because the kernel- malloc doesn't have realloc. Userspace applications should rather use reallocarray with an explicit NULL-pointer. Assuming reallocarray() will become available in c-stdlibs in the next few years, we nip mallocarray() in the bud to allow an easy transition to a system-provided version when the day comes.
This commit is contained in:
4
paste.c
4
paste.c
@@ -107,11 +107,11 @@ main(int argc, char *argv[])
|
||||
|
||||
/* populate delimiters */
|
||||
unescape(adelim);
|
||||
delim = emallocarray(utflen(adelim) + 1, sizeof(*delim));
|
||||
delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
|
||||
len = utftorunestr(adelim, delim);
|
||||
|
||||
/* populate file list */
|
||||
dsc = emallocarray(argc, sizeof(*dsc));
|
||||
dsc = ereallocarray(NULL, argc, sizeof(*dsc));
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-") == 0)
|
||||
|
Reference in New Issue
Block a user