aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-09-04 17:56:24 +0300
committerZyX <kp-pav@yandex.ru>2017-03-29 10:08:06 +0300
commitc4fe656fef5ade20da4861a2f1e5d0f776b0df8f (patch)
treed606e1d83975f1f187a3f1dee6d8d9caeec0aec7
parent6cc3d59ec8e4d6f32c8c3d9755c625e32512b8e2 (diff)
downloadrneovim-c4fe656fef5ade20da4861a2f1e5d0f776b0df8f.tar.gz
rneovim-c4fe656fef5ade20da4861a2f1e5d0f776b0df8f.tar.bz2
rneovim-c4fe656fef5ade20da4861a2f1e5d0f776b0df8f.zip
typval.h: Allow non-var expressions in TV_DICT_ITER first argument
-rw-r--r--src/nvim/eval.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 2dc1cb50af..a5b0a65497 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11248,26 +11248,26 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
-/*
- * Turn a dict into a list:
- * "what" == 0: list of keys
- * "what" == 1: list of values
- * "what" == 2: list of items
- */
-static void dict_list(typval_T *argvars, typval_T *rettv, int what)
-{
- if (argvars[0].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+/// Turn a dictionary into a list
+///
+/// @param[in] tv Dictionary to convert. Is checked for actually being
+/// a dictionary, will give an error if not.
+/// @param[out] rettv Location where result will be saved.
+/// @param[in] what What to save in rettv.
+static void dict_list(typval_T *const tv, typval_T *const rettv,
+ const DictListType what)
+{
+ if (tv->v_type != VAR_DICT) {
+ emsgf(_(e_dictreq));
return;
}
- dict_T *const d = argvars[0].vval.v_dict;
- if (d == NULL) {
+ if (tv->vval.v_dict == NULL) {
return;
}
tv_list_alloc_ret(rettv);
- TV_DICT_ITER(d, di, {
+ TV_DICT_ITER(tv->vval.v_dict, di, {
listitem_T *const li = tv_list_item_alloc();
tv_list_append(rettv->vval.v_list, li);