mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 06:17:04 +00:00
Add xreallocarray and remove nmemb argument from xrealloc.
This commit is contained in:
@ -794,7 +794,7 @@ window_copy_key_input(struct window_pane *wp, int key)
|
||||
}
|
||||
inputlen = strlen(data->inputstr);
|
||||
|
||||
data->inputstr = xrealloc(data->inputstr, 1, inputlen + n + 1);
|
||||
data->inputstr = xrealloc(data->inputstr, inputlen + n + 1);
|
||||
memcpy(data->inputstr + inputlen, pb->data, n);
|
||||
data->inputstr[inputlen + n] = '\0';
|
||||
break;
|
||||
@ -840,7 +840,7 @@ window_copy_key_input(struct window_pane *wp, int key)
|
||||
break;
|
||||
inputlen = strlen(data->inputstr) + 2;
|
||||
|
||||
data->inputstr = xrealloc(data->inputstr, 1, inputlen);
|
||||
data->inputstr = xrealloc(data->inputstr, inputlen);
|
||||
data->inputstr[inputlen - 2] = key;
|
||||
data->inputstr[inputlen - 1] = '\0';
|
||||
break;
|
||||
@ -1533,7 +1533,7 @@ window_copy_append_selection(struct window_pane *wp, const char *bufname)
|
||||
} else
|
||||
pb = paste_get_name(bufname);
|
||||
if (pb != NULL) {
|
||||
buf = xrealloc(buf, 1, len + pb->size);
|
||||
buf = xrealloc(buf, len + pb->size);
|
||||
memmove(buf + pb->size, buf, len);
|
||||
memcpy(buf, pb->data, pb->size);
|
||||
len += pb->size;
|
||||
@ -1589,7 +1589,7 @@ window_copy_copy_line(struct window_pane *wp,
|
||||
}
|
||||
}
|
||||
|
||||
*buf = xrealloc(*buf, 1, (*off) + ud.size);
|
||||
*buf = xrealloc(*buf, (*off) + ud.size);
|
||||
memcpy(*buf + *off, ud.data, ud.size);
|
||||
*off += ud.size;
|
||||
}
|
||||
@ -1597,7 +1597,7 @@ window_copy_copy_line(struct window_pane *wp,
|
||||
|
||||
/* Only add a newline if the line wasn't wrapped. */
|
||||
if (!wrapped || ex != xx) {
|
||||
*buf = xrealloc(*buf, 1, (*off) + 1);
|
||||
*buf = xrealloc(*buf, (*off) + 1);
|
||||
(*buf)[(*off)++] = '\n';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user