diff src/json.c @ 28315:62cc3b60493b v8.2.4683

patch 8.2.4683: verbose check with dict_find() to see if a key is present Commit: https://github.com/vim/vim/commit/4829c1c9e9095a3303caec9af7d02f6547f6df0e Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Apr 4 15:16:54 2022 +0100 patch 8.2.4683: verbose check with dict_find() to see if a key is present Problem: Verbose check with dict_find() to see if a key is present. Solution: Add dict_has_key(). (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10074)
author Bram Moolenaar <Bram@vim.org>
date Mon, 04 Apr 2022 16:30:04 +0200
parents 85b07a942518
children 0860b12c5788
line wrap: on
line diff
--- a/src/json.c
+++ b/src/json.c
@@ -1027,8 +1027,8 @@ item_end:
 
 	    case JSON_OBJECT:
 		if (cur_item != NULL
-			&& dict_find(top_item->jd_tv.vval.v_dict,
-						 top_item->jd_key, -1) != NULL)
+			&& dict_has_key(top_item->jd_tv.vval.v_dict,
+						(char *)top_item->jd_key))
 		{
 		    semsg(_(e_duplicate_key_in_json_str), top_item->jd_key);
 		    clear_tv(cur_item);