mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-16 16:41:35 +02:00
Add xreallocarray and remove nmemb argument from xrealloc.
This commit is contained in:
6
cmd.c
6
cmd.c
@ -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';
|
||||
}
|
||||
|
Reference in New Issue
Block a user