diff options
author | oni-link <knil.ino@gmail.com> | 2014-04-24 15:41:45 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-28 07:46:24 -0300 |
commit | 8d5a546d3fdd25c8221e0e6f78c6d7ee1ebda433 (patch) | |
tree | 6da8d24fcc537c8ab5a0eb6690711fa181959f8d | |
parent | 9da32a1f78fe075663466ac1349cb1495420591f (diff) | |
download | rneovim-8d5a546d3fdd25c8221e0e6f78c6d7ee1ebda433.tar.gz rneovim-8d5a546d3fdd25c8221e0e6f78c6d7ee1ebda433.tar.bz2 rneovim-8d5a546d3fdd25c8221e0e6f78c6d7ee1ebda433.zip |
Call to list_append_dict cannot fail.
Clean up the use of list_append_dict and remove error checks.
-rw-r--r-- | src/eval.c | 6 | ||||
-rw-r--r-- | src/eval.h | 2 | ||||
-rw-r--r-- | src/quickfix.c | 3 | ||||
-rw-r--r-- | src/tag.c | 8 |
4 files changed, 5 insertions, 14 deletions
diff --git a/src/eval.c b/src/eval.c index a2c752789f..b7b3bd45ee 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5535,20 +5535,16 @@ int list_append_tv(list_T *l, typval_T *tv) /* * Add a dictionary to a list. Used by getqflist(). - * Return FAIL when out of memory. */ -int list_append_dict(list_T *list, dict_T *dict) +void list_append_dict(list_T *list, dict_T *dict) { listitem_T *li = listitem_alloc(); - if (li == NULL) - return FAIL; li->li_tv.v_type = VAR_DICT; li->li_tv.v_lock = 0; li->li_tv.vval.v_dict = dict; list_append(list, li); ++dict->dv_refcount; - return OK; } /* diff --git a/src/eval.h b/src/eval.h index 9ad3185791..6c3c00c5db 100644 --- a/src/eval.h +++ b/src/eval.h @@ -64,7 +64,7 @@ listitem_T *list_find(list_T *l, long n); char_u *list_find_str(list_T *l, long idx); void list_append(list_T *l, listitem_T *item); int list_append_tv(list_T *l, typval_T *tv); -int list_append_dict(list_T *list, dict_T *dict); +void list_append_dict(list_T *list, dict_T *dict); int list_append_string(list_T *l, char_u *str, int len); int list_insert_tv(list_T *l, typval_T *tv, listitem_T *item); void list_remove(list_T *l, listitem_T *item, listitem_T *item2); diff --git a/src/quickfix.c b/src/quickfix.c index 090fceb975..cfbe07ac87 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3287,8 +3287,7 @@ int get_errorlist(win_T *wp, list_T *list) if ((dict = dict_alloc()) == NULL) return FAIL; - if (list_append_dict(list, dict) == FAIL) - return FAIL; + list_append_dict(list, dict); buf[0] = qfp->qf_type; buf[1] = NUL; @@ -789,10 +789,7 @@ do_tag ( if ((dict = dict_alloc()) == NULL) continue; - if (list_append_dict(list, dict) == FAIL) { - vim_free(dict); - continue; - } + list_append_dict(list, dict); dict_add_nr_str(dict, "text", 0L, tag_name); dict_add_nr_str(dict, "filename", 0L, fname); @@ -2878,8 +2875,7 @@ int get_tags(list_T *list, char_u *pat) if ((dict = dict_alloc()) == NULL) ret = FAIL; - if (list_append_dict(list, dict) == FAIL) - ret = FAIL; + list_append_dict(list, dict); full_fname = tag_full_fname(&tp); if (add_tag_field(dict, "name", tp.tagname, tp.tagname_end) == FAIL |