Mercurial > vim
diff src/eval.c @ 17168:1d30eb64a7a2 v8.1.1583
patch 8.1.1583: set_ref_in_list() only sets ref in items
commit https://github.com/vim/vim/commit/7be3ab25891fec711d8a2d9d242711a9155852b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 23 01:46:15 2019 +0200
patch 8.1.1583: set_ref_in_list() only sets ref in items
Problem: Set_ref_in_list() only sets ref in items.
Solution: Rename to set_ref_in_list_items() to avoid confusion.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 23 Jun 2019 02:00:06 +0200 |
parents | ebe9aab81898 |
children | 6990c1160ea5 |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -5841,13 +5841,43 @@ set_ref_in_ht(hashtab_T *ht, int copyID, } /* + * Mark a dict and its items with "copyID". + * Returns TRUE if setting references failed somehow. + */ + int +set_ref_in_dict(dict_T *d, int copyID) +{ + if (d != NULL && d->dv_copyID != copyID) + { + d->dv_copyID = copyID; + return set_ref_in_ht(&d->dv_hashtab, copyID, NULL); + } + return FALSE; +} + +/* + * Mark a list and its items with "copyID". + * Returns TRUE if setting references failed somehow. + */ + int +set_ref_in_list(list_T *ll, int copyID) +{ + if (ll != NULL && ll->lv_copyID != copyID) + { + ll->lv_copyID = copyID; + return set_ref_in_list_items(ll, copyID, NULL); + } + return FALSE; +} + +/* * Mark all lists and dicts referenced through list "l" with "copyID". * "ht_stack" is used to add hashtabs to be marked. Can be NULL. * * Returns TRUE if setting references failed somehow. */ int -set_ref_in_list(list_T *l, int copyID, ht_stack_T **ht_stack) +set_ref_in_list_items(list_T *l, int copyID, ht_stack_T **ht_stack) { listitem_T *li; int abort = FALSE; @@ -5930,7 +5960,7 @@ set_ref_in_item( ll->lv_copyID = copyID; if (list_stack == NULL) { - abort = set_ref_in_list(ll, copyID, ht_stack); + abort = set_ref_in_list_items(ll, copyID, ht_stack); } else {