mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +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:
@@ -719,13 +719,10 @@ restofline:
|
||||
if (qfprev == NULL)
|
||||
goto error2;
|
||||
if (*errmsg && !multiignore) {
|
||||
len = (int)STRLEN(qfprev->qf_text);
|
||||
ptr = xmalloc(len + STRLEN(errmsg) + 2);
|
||||
STRCPY(ptr, qfprev->qf_text);
|
||||
free(qfprev->qf_text);
|
||||
qfprev->qf_text = ptr;
|
||||
*(ptr += len) = '\n';
|
||||
STRCPY(++ptr, errmsg);
|
||||
size_t len = STRLEN(qfprev->qf_text);
|
||||
qfprev->qf_text = xrealloc(qfprev->qf_text, len + STRLEN(errmsg) + 2);
|
||||
qfprev->qf_text[len] = '\n';
|
||||
STRCPY(qfprev->qf_text + len + 1, errmsg);
|
||||
}
|
||||
if (qfprev->qf_nr == -1)
|
||||
qfprev->qf_nr = enr;
|
||||
|
Reference in New Issue
Block a user