diff src/dict.c @ 29442:827d9f2b7a71 v9.0.0063

patch 9.0.0063: too many type casts for dict_get functions Commit: https://github.com/vim/vim/commit/d61efa50f8f5b9d9dcbc136705cc33874f0fdcb3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 23 09:52:04 2022 +0100 patch 9.0.0063: too many type casts for dict_get functions Problem: Too many type casts for dict_get functions. Solution: Change the key argument from "char_u *" to "char *".
author Bram Moolenaar <Bram@vim.org>
date Sat, 23 Jul 2022 11:00:04 +0200
parents 175eacde28b8
children 34151eb6ae25
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -662,11 +662,11 @@ dict_has_key(dict_T *d, char *key)
  * Returns FAIL if the entry doesn't exist or out of memory.
  */
     int
-dict_get_tv(dict_T *d, char_u *key, typval_T *rettv)
+dict_get_tv(dict_T *d, char *key, typval_T *rettv)
 {
     dictitem_T	*di;
 
-    di = dict_find(d, key, -1);
+    di = dict_find(d, (char_u *)key, -1);
     if (di == NULL)
 	return FAIL;
     copy_tv(&di->di_tv, rettv);
@@ -680,12 +680,12 @@ dict_get_tv(dict_T *d, char_u *key, typv
  * Returns NULL if the entry doesn't exist or out of memory.
  */
     char_u *
-dict_get_string(dict_T *d, char_u *key, int save)
+dict_get_string(dict_T *d, char *key, int save)
 {
     dictitem_T	*di;
     char_u	*s;
 
-    di = dict_find(d, key, -1);
+    di = dict_find(d, (char_u *)key, -1);
     if (di == NULL)
 	return NULL;
     s = tv_get_string(&di->di_tv);
@@ -699,7 +699,7 @@ dict_get_string(dict_T *d, char_u *key, 
  * Returns 0 if the entry doesn't exist.
  */
     varnumber_T
-dict_get_number(dict_T *d, char_u *key)
+dict_get_number(dict_T *d, char *key)
 {
     return dict_get_number_def(d, key, 0);
 }
@@ -709,11 +709,11 @@ dict_get_number(dict_T *d, char_u *key)
  * Returns "def" if the entry doesn't exist.
  */
     varnumber_T
-dict_get_number_def(dict_T *d, char_u *key, int def)
+dict_get_number_def(dict_T *d, char *key, int def)
 {
     dictitem_T	*di;
 
-    di = dict_find(d, key, -1);
+    di = dict_find(d, (char_u *)key, -1);
     if (di == NULL)
 	return def;
     return tv_get_number(&di->di_tv);
@@ -745,11 +745,11 @@ dict_get_number_check(dict_T *d, char_u 
  * Returns "def" if the entry doesn't exist.
  */
     varnumber_T
-dict_get_bool(dict_T *d, char_u *key, int def)
+dict_get_bool(dict_T *d, char *key, int def)
 {
     dictitem_T	*di;
 
-    di = dict_find(d, key, -1);
+    di = dict_find(d, (char_u *)key, -1);
     if (di == NULL)
 	return def;
     return tv_get_bool(&di->di_tv);