Remove simpler cases of OOM error handling (after *alloc calls)

By simpler cases I mean cases where the OOM error is not expected to be handled
by the caller of the function that calls `alloc`, `lalloc`, `xrealloc`,
`xmalloc`, `alloc_clear`, and `lalloc_clear`.

These are the functions that:

 - Do not return an allocated buffer
 - Have OOM as the only error condition

I took note of the functions that expect the caller to handle the OOM error and
will go through them to check all the callers that may be handling OOM error in
future commits.

I'm ignoring eval.c and ex_.c in this series of commits. eval.c will soon be
obsolete and I will deal with ex_.c in later PRs.
This commit is contained in:
Felipe Oliveira Carvalho
2014-04-01 01:41:39 -03:00
committed by Thiago de Arruda
parent 6bbffee0a5
commit 13848aadbf
39 changed files with 944 additions and 1499 deletions

View File

@@ -441,8 +441,6 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
width += PRINT_NUMBER_WIDTH;
tbuf = alloc(width + IOSIZE);
if (tbuf == NULL)
return;
if (*p_header != NUL) {
linenr_T tmp_lnum, tmp_topline, tmp_botline;
@@ -2526,10 +2524,6 @@ int mch_print_begin(prt_settings_T *psettings)
alloc(sizeof(struct prt_ps_resource_S));
res_cmap = (struct prt_ps_resource_S *)
alloc(sizeof(struct prt_ps_resource_S));
if (res_prolog == NULL || res_encoding == NULL
|| res_cidfont == NULL || res_cmap == NULL
)
goto theend;
/*
* PS DSC Header comments - no PS code!
@@ -2863,7 +2857,6 @@ int mch_print_begin(prt_settings_T *psettings)
/* Fail if any problems writing out to the PS file */
retval = !prt_file_error;
theend:
vim_free(res_prolog);
vim_free(res_encoding);
vim_free(res_cidfont);