mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
Replace alloc() with xmalloc() and remove immediate OOM checks
This commit is contained in:
@@ -2983,8 +2983,7 @@ void add_termcode(char_u *name, char_u *string, int flags)
|
||||
*/
|
||||
if (tc_len == tc_max_len) {
|
||||
tc_max_len += 20;
|
||||
new_tc = (struct termcode *)alloc(
|
||||
(unsigned)(tc_max_len * sizeof(struct termcode)));
|
||||
new_tc = xmalloc(tc_max_len * sizeof(struct termcode));
|
||||
for (i = 0; i < tc_len; ++i)
|
||||
new_tc[i] = termcodes[i];
|
||||
free(termcodes);
|
||||
@@ -4170,7 +4169,7 @@ replace_termcodes (
|
||||
* Allocate space for the translation. Worst case a single character is
|
||||
* replaced by 6 bytes (shifted special key), plus a NUL at the end.
|
||||
*/
|
||||
result = alloc((unsigned)STRLEN(from) * 6 + 1);
|
||||
result = xmalloc(STRLEN(from) * 6 + 1);
|
||||
|
||||
src = from;
|
||||
|
||||
@@ -4376,7 +4375,7 @@ void show_termcodes(void)
|
||||
|
||||
if (tc_len == 0) /* no terminal codes (must be GUI) */
|
||||
return;
|
||||
items = (int *)alloc((unsigned)(sizeof(int) * tc_len));
|
||||
items = xmalloc(sizeof(int) * tc_len);
|
||||
|
||||
/* Highlight title */
|
||||
MSG_PUTS_TITLE(_("\n--- Terminal keys ---"));
|
||||
|
Reference in New Issue
Block a user