Add xreallocarray and remove nmemb argument from xrealloc.

This commit is contained in:
nicm
2014-10-08 17:35:58 +00:00
parent 77efcf8bdd
commit a27ba6e380
17 changed files with 65 additions and 48 deletions

6
cmd.c
View File

@ -222,7 +222,7 @@ cmd_stringify_argv(int argc, char **argv)
for (i = 0; i < argc; i++) {
len += strlen(argv[i]) + 1;
buf = xrealloc(buf, 1, len);
buf = xrealloc(buf, len);
if (i == 0)
*buf = '\0';
@ -1302,11 +1302,11 @@ cmd_template_replace(const char *template, const char *s, int idx)
ptr++;
len += strlen(s);
buf = xrealloc(buf, 1, len + 1);
buf = xrealloc(buf, len + 1);
strlcat(buf, s, len + 1);
continue;
}
buf = xrealloc(buf, 1, len + 2);
buf = xrealloc(buf, len + 2);
buf[len++] = ch;
buf[len] = '\0';
}