diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-03 17:28:57 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-03 17:28:57 +0300 |
commit | efc624c2fe029a4ab494672c43366e8c57c19108 (patch) | |
tree | d3e79b9621a7918efffabebc597c14016cbe0102 | |
parent | f21725946c575884e04e79942850e7d0bc040ef9 (diff) | |
download | rneovim-efc624c2fe029a4ab494672c43366e8c57c19108.tar.gz rneovim-efc624c2fe029a4ab494672c43366e8c57c19108.tar.bz2 rneovim-efc624c2fe029a4ab494672c43366e8c57c19108.zip |
eval: Fix errorneous early exit when converting lists and dictionaries
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | src/nvim/eval/typval_encode.c.h | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d1ae94706f..a0f511ab23 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19151,7 +19151,7 @@ static inline int _nothing_conv_list_start(typval_T *const tv) #define TYPVAL_ENCODE_CONV_LIST_START(tv, len) \ do { \ if (_nothing_conv_list_start(tv) != NOTDONE) { \ - return OK; \ + goto typval_encode_stop_converting_one_item; \ } \ } while (0) @@ -19190,7 +19190,7 @@ static inline int _nothing_conv_dict_start(typval_T *const tv, if (_nothing_conv_dict_start(tv, (dict_T **)&dict, \ (void *)&TYPVAL_ENCODE_NODICT_VAR) \ != NOTDONE) { \ - return OK; \ + goto typval_encode_stop_converting_one_item; \ } \ } while (0) diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index 69f805498a..5795d339f0 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -565,7 +565,10 @@ _convert_one_value_regular_dict: return FAIL; } } +typval_encode_stop_converting_one_item: return OK; + // Prevent “unused label” warnings. + goto typval_encode_stop_converting_one_item; } TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE( @@ -595,6 +598,9 @@ TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE( == FAIL) { goto encode_vim_to__error_ret; } +/// Label common for this and convert_one_value functions, used for escaping +/// from macros like TYPVAL_ENCODE_CONV_DICT_START. +typval_encode_stop_converting_one_item: while (_mp_size(mpstack)) { MPConvStackVal *cur_mpsv = &_mp_last(mpstack); typval_T *tv = NULL; @@ -754,5 +760,7 @@ TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE( encode_vim_to__error_ret: _mp_destroy(mpstack); return FAIL; + // Prevent “unused label” warnings. + goto typval_encode_stop_converting_one_item; } #endif // NVIM_EVAL_TYPVAL_ENCODE_C_H |