diff options
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r-- | src/nvim/ex_eval.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 277f7d8cfb..929ff4211f 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -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; } } |