mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
Replace alloc() with xmalloc() and remove immediate OOM checks
This commit is contained in:
@@ -244,11 +244,8 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
|
||||
while (*plist != NULL)
|
||||
plist = &(*plist)->next;
|
||||
|
||||
elem = (struct msglist *)alloc((unsigned)sizeof(struct msglist));
|
||||
if (elem == NULL) {
|
||||
suppress_errthrow = TRUE;
|
||||
EMSG(_(e_outofmem));
|
||||
} else {
|
||||
elem = xmalloc(sizeof(struct msglist));
|
||||
{
|
||||
elem->msg = vim_strsave(mesg);
|
||||
{
|
||||
elem->next = NULL;
|
||||
@@ -469,9 +466,7 @@ static int throw_exception(void *value, int type, char_u *cmdname)
|
||||
}
|
||||
}
|
||||
|
||||
excp = (except_T *)alloc((unsigned)sizeof(except_T));
|
||||
if (excp == NULL)
|
||||
goto nomem;
|
||||
excp = xmalloc(sizeof(except_T));
|
||||
|
||||
if (type == ET_ERROR)
|
||||
/* Store the original message and prefix the exception value with
|
||||
@@ -1289,18 +1284,12 @@ void ex_try(exarg_T *eap)
|
||||
* to save the value.
|
||||
*/
|
||||
if (emsg_silent) {
|
||||
eslist_T *elem;
|
||||
|
||||
elem = (eslist_T *)alloc((unsigned)sizeof(struct eslist_elem));
|
||||
if (elem == NULL)
|
||||
EMSG(_(e_outofmem));
|
||||
else {
|
||||
elem->saved_emsg_silent = emsg_silent;
|
||||
elem->next = cstack->cs_emsg_silent_list;
|
||||
cstack->cs_emsg_silent_list = elem;
|
||||
cstack->cs_flags[cstack->cs_idx] |= CSF_SILENT;
|
||||
emsg_silent = 0;
|
||||
}
|
||||
eslist_T *elem = xmalloc(sizeof(struct eslist_elem));
|
||||
elem->saved_emsg_silent = emsg_silent;
|
||||
elem->next = cstack->cs_emsg_silent_list;
|
||||
cstack->cs_emsg_silent_list = elem;
|
||||
cstack->cs_flags[cstack->cs_idx] |= CSF_SILENT;
|
||||
emsg_silent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user