mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
Replace alloc() with xmalloc() and remove immediate OOM checks
This commit is contained in:
@@ -5653,7 +5653,7 @@ static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T e
|
||||
if (reg_tofree == NULL || len >= (int)reg_tofreelen) {
|
||||
len += 50; /* get some extra */
|
||||
free(reg_tofree);
|
||||
reg_tofree = alloc(len);
|
||||
reg_tofree = xmalloc(len);
|
||||
reg_tofreelen = len;
|
||||
}
|
||||
STRCPY(reg_tofree, regline);
|
||||
@@ -6404,7 +6404,7 @@ char_u *regtilde(char_u *source, int magic)
|
||||
if (reg_prev_sub != NULL) {
|
||||
/* length = len(newsub) - 1 + len(prev_sub) + 1 */
|
||||
prevlen = (int)STRLEN(reg_prev_sub);
|
||||
tmpsub = alloc((unsigned)(STRLEN(newsub) + prevlen));
|
||||
tmpsub = xmalloc(STRLEN(newsub) + prevlen);
|
||||
/* copy prefix */
|
||||
len = (int)(p - newsub); /* not including ~ */
|
||||
memmove(tmpsub, newsub, (size_t)len);
|
||||
|
Reference in New Issue
Block a user