eval/typval: Make tv_list_item_remove return pointer to the next item

This commit is contained in:
ZyX
2017-12-24 02:41:34 +03:00
parent 608c3d7baf
commit ac55558c97
3 changed files with 24 additions and 22 deletions

View File

@@ -64,12 +64,17 @@ static listitem_T *tv_list_item_alloc(void)
///
/// @param[out] l List to remove item from.
/// @param[in,out] item Item to remove.
void tv_list_item_remove(list_T *const l, listitem_T *const item)
///
/// @return Pointer to the list item just after removed one, NULL if removed
/// item was the last one.
listitem_T *tv_list_item_remove(list_T *const l, listitem_T *const item)
FUNC_ATTR_NONNULL_ALL
{
listitem_T *const next_item = TV_LIST_ITEM_NEXT(l, item);
tv_list_remove_items(l, item, item);
tv_clear(TV_LIST_ITEM_TV(item));
xfree(item);
return next_item;
}
//{{{2 List watchers