mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 03:30:37 +00:00
Remove OOM checks: suggested changes in review
- Replace a vim_strsave/free pair with xrealloc - Use xmallocz() in some places - Use xrealloc() and forget about the NULL pointer case - Remove invalid comment - Remove unnecessary checks - Replace a complicated xmalloc/STRCPY/free code chunk code with xrealloc() - Replace a vim_strsave/free code chunk with xrealloc()
This commit is contained in:
@@ -1986,7 +1986,7 @@ static void alloc_cmdbuff(int len)
|
||||
else
|
||||
len += 20;
|
||||
|
||||
ccline.cmdbuff = xmalloc(len); /* caller should check for out-of-memory */
|
||||
ccline.cmdbuff = xmalloc(len);
|
||||
ccline.cmdbufflen = len;
|
||||
}
|
||||
|
||||
@@ -2179,10 +2179,7 @@ void put_on_cmdline(char_u *str, int len, int redraw)
|
||||
if (len < 0)
|
||||
len = (int)STRLEN(str);
|
||||
|
||||
/* Check if ccline.cmdbuff needs to be longer */
|
||||
if (ccline.cmdlen + len + 1 >= ccline.cmdbufflen) {
|
||||
realloc_cmdbuff(ccline.cmdlen + len + 1);
|
||||
}
|
||||
realloc_cmdbuff(ccline.cmdlen + len + 1);
|
||||
|
||||
if (!ccline.overstrike) {
|
||||
memmove(ccline.cmdbuff + ccline.cmdpos + len,
|
||||
|
||||
Reference in New Issue
Block a user