Replace alloc() with xmalloc() and remove immediate OOM checks

This commit is contained in:
Felipe Oliveira Carvalho
2014-05-09 03:30:26 -03:00
parent a80d7e86c1
commit 21784aeb00
42 changed files with 413 additions and 640 deletions

View File

@@ -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);