diff options
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 085e7d7e9..3cfa4b7a5 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 { |