summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-04-04 15:16:54 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-04 15:16:54 +0100
commit4829c1c9e9095a3303caec9af7d02f6547f6df0e (patch)
tree2b3819cd2ea17b652ba29f3a8a6ea9945ec6c4bb /src/channel.c
parent7a411a306f90339d8686e42ac16e1ae4fc7533c5 (diff)
patch 8.2.4683: verbose check with dict_find() to see if a key is presentv8.2.4683
Problem: Verbose check with dict_find() to see if a key is present. Solution: Add dict_has_key(). (Yegappan Lakshmanan, closes #10074)
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/channel.c b/src/channel.c
index 470092e153..66ba55df65 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -4460,8 +4460,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
}
if (argvars[2].v_type == VAR_DICT)
- if (dict_find(argvars[2].vval.v_dict, (char_u *)"callback", -1)
- != NULL)
+ if (dict_has_key(argvars[2].vval.v_dict, "callback"))
callback_present = TRUE;
if (eval || callback_present)
@@ -4482,7 +4481,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
if (di != NULL)
id = di->di_tv.vval.v_number;
}
- if (dict_find(d, (char_u *)"jsonrpc", -1) == NULL)
+ if (!dict_has_key(d, "jsonrpc"))
dict_add_string(d, "jsonrpc", (char_u *)"2.0");
text = json_encode_lsp_msg(&argvars[1]);
}