diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-07 15:15:14 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-07 15:15:14 +0300 |
commit | a970c1a95785cce9176274ffd4b783c79372afed (patch) | |
tree | 2757e6ef9e6a26636166a0032177c8c45bf3ad40 /src/nvim/eval.c | |
parent | 7d0a892b374a8e5e025905a28e54b98b4f62f533 (diff) | |
download | rneovim-a970c1a95785cce9176274ffd4b783c79372afed.tar.gz rneovim-a970c1a95785cce9176274ffd4b783c79372afed.tar.bz2 rneovim-a970c1a95785cce9176274ffd4b783c79372afed.zip |
eval: Make sure that copyID is reset when needed
Works by making value pushed on stack represent the exhausted list.
Fixes #5901, except for dictionaries which need similar adjustment.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4501c2e0a6..f355b3eac4 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19147,23 +19147,25 @@ static inline void _nothing_conv_func_end(typval_T *const tv, const int copyID) } \ } while (0) -static inline int _nothing_conv_list_start(typval_T *const tv) +static inline int _nothing_conv_real_list_after_start( + typval_T *const tv, MPConvStackVal *const mpsv) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_WARN_UNUSED_RESULT { - if (tv == NULL) { - return NOTDONE; - } + assert(tv != NULL); tv->v_lock = VAR_UNLOCKED; if (tv->vval.v_list->lv_refcount > 1) { tv->vval.v_list->lv_refcount--; tv->vval.v_list = NULL; + mpsv->data.l.li = NULL; return OK; } return NOTDONE; } -#define TYPVAL_ENCODE_CONV_LIST_START(tv, len) \ +#define TYPVAL_ENCODE_CONV_LIST_START(tv, len) + +#define TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START(tv, mpsv) \ do { \ - if (_nothing_conv_list_start(tv) != NOTDONE) { \ + if (_nothing_conv_real_list_after_start(tv, &mpsv) != NOTDONE) { \ goto typval_encode_stop_converting_one_item; \ } \ } while (0) @@ -19253,6 +19255,7 @@ static inline void _nothing_conv_dict_end(typval_T *const tv, #undef TYPVAL_ENCODE_CONV_EMPTY_LIST #undef TYPVAL_ENCODE_CONV_EMPTY_DICT #undef TYPVAL_ENCODE_CONV_LIST_START +#undef TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START #undef TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS #undef TYPVAL_ENCODE_CONV_LIST_END #undef TYPVAL_ENCODE_CONV_DICT_START |