diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-06-23 01:46:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-06-23 01:46:15 +0200 |
commit | 7be3ab25891fec711d8a2d9d242711a9155852b6 (patch) | |
tree | 3dab3f000e881253f5ca0961ea13b8abc2a0d39d /src/eval.c | |
parent | 0fcf26ba4ffaaa6a2fb8d879dc24b5f7e1bb6a13 (diff) |
patch 8.1.1583: set_ref_in_list() only sets ref in itemsv8.1.1583
Problem: Set_ref_in_list() only sets ref in items.
Solution: Rename to set_ref_in_list_items() to avoid confusion.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 085e7d7e9a..3cfa4b7a55 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5841,13 +5841,43 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack) } /* + * 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 { |