diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-04-19 16:59:49 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-24 10:31:31 -0300 |
commit | 28b03dd19037cdf1b15dd1050f39465be87e7195 (patch) | |
tree | 51292d922ff5c4bc24d815fea296cbd1b5e5d49f /src/eval.c | |
parent | 6d193b0b37c6dbf529b51353e7e3db69be310106 (diff) | |
download | rneovim-28b03dd19037cdf1b15dd1050f39465be87e7195.tar.gz rneovim-28b03dd19037cdf1b15dd1050f39465be87e7195.tar.bz2 rneovim-28b03dd19037cdf1b15dd1050f39465be87e7195.zip |
No OOM error conditions in some functions of window.c
- alloc_tabpage()
- win_alloc_lines()
- win_alloc_aucmd_win()
- new_frame()
- win_alloc()
TODO: don't handle OOM after calls to dict_alloc()
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/eval.c b/src/eval.c index 09e1f8b4aa..9506dd989e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6105,23 +6105,21 @@ void set_ref_in_item(typval_T *tv, int copyID) */ dict_T *dict_alloc(void) { - dict_T *d; - - d = (dict_T *)alloc(sizeof(dict_T)); - if (d != NULL) { - /* Add the dict to the list of dicts for garbage collection. */ - if (first_dict != NULL) - first_dict->dv_used_prev = d; - d->dv_used_next = first_dict; - d->dv_used_prev = NULL; - first_dict = d; - - hash_init(&d->dv_hashtab); - d->dv_lock = 0; - d->dv_scope = 0; - d->dv_refcount = 0; - d->dv_copyID = 0; - } + dict_T *d = xmalloc(sizeof(dict_T)); + + /* Add the dict to the list of dicts for garbage collection. */ + if (first_dict != NULL) + first_dict->dv_used_prev = d; + d->dv_used_next = first_dict; + d->dv_used_prev = NULL; + first_dict = d; + + hash_init(&d->dv_hashtab); + d->dv_lock = 0; + d->dv_scope = 0; + d->dv_refcount = 0; + d->dv_copyID = 0; + return d; } |