*: Remove most calls to tv_list_item_alloc

Still left calls in eval/typval.c and test/unit/eval/helpers.lua. Latter is the 
only reason why function did not receive `static` modifier.
This commit is contained in:
ZyX
2017-12-24 01:43:42 +03:00
parent 249bdb07dd
commit 0c533a488f
6 changed files with 179 additions and 116 deletions

View File

@@ -787,16 +787,14 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
for (uint32_t i = 0; i < obj.data.array.size; i++) {
Object item = obj.data.array.items[i];
listitem_T *li = tv_list_item_alloc();
typval_T li_tv;
if (!object_to_vim(item, TV_LIST_ITEM_TV(li), err)) {
// cleanup
tv_list_item_free(li);
if (!object_to_vim(item, &li_tv, err)) {
tv_list_free(list);
return false;
}
tv_list_append(list, li);
tv_list_append_owned_tv(list, li_tv);
}
tv_list_ref(list);