summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-23 09:52:04 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-23 09:52:04 +0100
commitd61efa50f8f5b9d9dcbc136705cc33874f0fdcb3 (patch)
tree7ca7416ffda546d9f45ba93d3c93f3418bd6bcd0 /src
parent5ac50de83f1b4136f903c51a1d4e7d84a26c2271 (diff)
patch 9.0.0063: too many type casts for dict_get functionsv9.0.0063
Problem: Too many type casts for dict_get functions. Solution: Change the key argument from "char_u *" to "char *".
Diffstat (limited to 'src')
-rw-r--r--src/autocmd.c21
-rw-r--r--src/change.c10
-rw-r--r--src/dict.c18
-rw-r--r--src/evalbuffer.c6
-rw-r--r--src/evalfunc.c11
-rw-r--r--src/evalwindow.c20
-rw-r--r--src/fileio.c4
-rw-r--r--src/filepath.c2
-rw-r--r--src/gui_w32.c4
-rw-r--r--src/highlight.c9
-rw-r--r--src/insexpand.c32
-rw-r--r--src/map.c30
-rw-r--r--src/match.c13
-rw-r--r--src/popupwin.c53
-rw-r--r--src/proto/dict.pro10
-rw-r--r--src/quickfix.c28
-rw-r--r--src/search.c5
-rw-r--r--src/sign.c18
-rw-r--r--src/tag.c9
-rw-r--r--src/terminal.c14
-rw-r--r--src/testing.c42
-rw-r--r--src/textprop.c32
-rw-r--r--src/time.c2
-rw-r--r--src/version.c2
24 files changed, 193 insertions, 202 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index c376f20a23..cc9d99d537 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -2833,7 +2833,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
}
}
- group_name = dict_get_string(event_dict, (char_u *)"group", TRUE);
+ group_name = dict_get_string(event_dict, "group", TRUE);
if (group_name == NULL || *group_name == NUL)
// if the autocmd group name is not specified, then use the current
// autocmd group
@@ -2868,7 +2868,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
{
varnumber_T bnum;
- bnum = dict_get_number_def(event_dict, (char_u *)"bufnr", -1);
+ bnum = dict_get_number_def(event_dict, "bufnr", -1);
if (bnum == -1)
continue;
@@ -2908,13 +2908,13 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
pat = (char_u *)"";
}
- once = dict_get_bool(event_dict, (char_u *)"once", FALSE);
- nested = dict_get_bool(event_dict, (char_u *)"nested", FALSE);
+ once = dict_get_bool(event_dict, "once", FALSE);
+ nested = dict_get_bool(event_dict, "nested", FALSE);
// if 'replace' is true, then remove all the commands associated with
// this autocmd event/group and add the new command.
- replace = dict_get_bool(event_dict, (char_u *)"replace", FALSE);
+ replace = dict_get_bool(event_dict, "replace", FALSE);
- cmd = dict_get_string(event_dict, (char_u *)"cmd", TRUE);
+ cmd = dict_get_string(event_dict, "cmd", TRUE);
if (cmd == NULL)
{
if (delete)
@@ -3076,8 +3076,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
// return only the autocmds in the specified group
if (dict_has_key(argvars[0].vval.v_dict, "group"))
{
- name = dict_get_string(argvars[0].vval.v_dict,
- (char_u *)"group", TRUE);
+ name = dict_get_string(argvars[0].vval.v_dict, "group", TRUE);
if (name == NULL)
return;
@@ -3101,8 +3100,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
{
int i;
- name = dict_get_string(argvars[0].vval.v_dict,
- (char_u *)"event", TRUE);
+ name = dict_get_string(argvars[0].vval.v_dict, "event", TRUE);
if (name == NULL)
return;
@@ -3127,8 +3125,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
// return only the autocmds for the specified pattern
if (dict_has_key(argvars[0].vval.v_dict, "pattern"))
{
- pat = dict_get_string(argvars[0].vval.v_dict,
- (char_u *)"pattern", TRUE);
+ pat = dict_get_string(argvars[0].vval.v_dict, "pattern", TRUE);
if (pat == NULL)
return;
}
diff --git a/src/change.c b/src/change.c
index 2bb6388e5a..66f34c00c5 100644
--- a/src/change.c
+++ b/src/change.c
@@ -172,9 +172,9 @@ check_recorded_changes(
FOR_ALL_LIST_ITEMS(buf->b_recorded_changes, li)
{
prev_lnum = (linenr_T)dict_get_number(
- li->li_tv.vval.v_dict, (char_u *)"lnum");
+ li->li_tv.vval.v_dict, "lnum");
prev_lnume = (linenr_T)dict_get_number(
- li->li_tv.vval.v_dict, (char_u *)"end");
+ li->li_tv.vval.v_dict, "end");
if (prev_lnum >= lnum || prev_lnum > lnume || prev_lnume >= lnum)
{
// the current change is going to make the line number in
@@ -384,13 +384,13 @@ invoke_listeners(buf_T *buf)
{
varnumber_T lnum;
- lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"lnum");
+ lnum = dict_get_number(li->li_tv.vval.v_dict, "lnum");
if (start > lnum)
start = lnum;
- lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end");
+ lnum = dict_get_number(li->li_tv.vval.v_dict, "end");
if (end < lnum)
end = lnum;
- added += dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added");
+ added += dict_get_number(li->li_tv.vval.v_dict, "added");
}
argv[1].v_type = VAR_NUMBER;
argv[1].vval.v_number = start;
diff --git a/src/dict.c b/src/dict.c
index d2819578a7..29608bd88c 100644
--- 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, typval_T *rettv)
* 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, int save)
* 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 *key)
* 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);
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index 0808c7e6a2..fe41f08487 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -695,9 +695,9 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
if (sel_d != NULL)
{
filtered = TRUE;
- sel_buflisted = dict_get_bool(sel_d, (char_u *)"buflisted", FALSE);
- sel_bufloaded = dict_get_bool(sel_d, (char_u *)"bufloaded", FALSE);
- sel_bufmodified = dict_get_bool(sel_d, (char_u *)"bufmodified",
+ sel_buflisted = dict_get_bool(sel_d, "buflisted", FALSE);
+ sel_bufloaded = dict_get_bool(sel_d, "bufloaded", FALSE);
+ sel_bufmodified = dict_get_bool(sel_d, "bufmodified",
FALSE);
}
}
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 580f5d1bff..8d6255d48b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4217,8 +4217,7 @@ f_expandcmd(typval_T *argvars, typval_T *rettv)
return;
if (argvars[1].v_type == VAR_DICT
- && dict_get_bool(argvars[1].vval.v_dict, (char_u *)"errmsg",
- VVAL_FALSE))
+ && dict_get_bool(argvars[1].vval.v_dict, "errmsg", VVAL_FALSE))
emsgoff = FALSE;
rettv->v_type = VAR_STRING;
@@ -9172,7 +9171,7 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED)
if ((d = argvars[0].vval.v_dict) != NULL)
{
- csearch = dict_get_string(d, (char_u *)"char", FALSE);
+ csearch = dict_get_string(d, "char", FALSE);
if (csearch != NULL)
{
if (enc_utf8)
@@ -9368,7 +9367,7 @@ f_setreg(typval_T *argvars, typval_T *rettv)
if (di != NULL)
regcontents = &di->di_tv;
- stropt = dict_get_string(d, (char_u *)"regtype", FALSE);
+ stropt = dict_get_string(d, "regtype", FALSE);
if (stropt != NULL)
{
int ret = get_yank_type(&stropt, &yank_type, &block_len);
@@ -9382,14 +9381,14 @@ f_setreg(typval_T *argvars, typval_T *rettv)
if (regname == '"')
{
- stropt = dict_get_string(d, (char_u *)"points_to", FALSE);
+ stropt = dict_get_string(d, "points_to", FALSE);
if (stropt != NULL)
{
pointreg = *stropt;
regname = pointreg;
}
}
- else if (dict_get_bool(d, (char_u *)"isunnamed", -1) > 0)
+ else if (dict_get_bool(d, "isunnamed", -1) > 0)
pointreg = regname;
}
else
diff --git a/src/evalwindow.c b/src/evalwindow.c
index 00d63cd365..d507ab3677 100644
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -1016,11 +1016,11 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv)
}
d = argvars[2].vval.v_dict;
- if (dict_get_bool(d, (char_u *)"vertical", FALSE))
+ if (dict_get_bool(d, "vertical", FALSE))
flags |= WSP_VERT;
if ((di = dict_find(d, (char_u *)"rightbelow", -1)) != NULL)
flags |= tv_get_bool(&di->di_tv) ? WSP_BELOW : WSP_ABOVE;
- size = (int)dict_get_number(d, (char_u *)"size");
+ size = (int)dict_get_number(d, "size");
}
win_move_into_split(wp, targetwin, size, flags);
@@ -1236,27 +1236,27 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED)
else
{
if (dict_has_key(dict, "lnum"))
- curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u *)"lnum");
+ curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, "lnum");
if (dict_has_key(dict, "col"))
- curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u *)"col");
+ curwin->w_cursor.col = (colnr_T)dict_get_number(dict, "col");
if (dict_has_key(dict, "coladd"))
- curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u *)"coladd");
+ curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, "coladd");
if (dict_has_key(dict, "curswant"))
{
- curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u *)"curswant");
+ curwin->w_curswant = (colnr_T)dict_get_number(dict, "curswant");
curwin->w_set_curswant = FALSE;
}
if (dict_has_key(dict, "topline"))
- set_topline(curwin, (linenr_T)dict_get_number(dict, (char_u *)"topline"));
+ set_topline(curwin, (linenr_T)dict_get_number(dict, "topline"));
#ifdef FEAT_DIFF
if (dict_has_key(dict, "topfill"))
- curwin->w_topfill = (int)dict_get_number(dict, (char_u *)"topfill");
+ curwin->w_topfill = (int)dict_get_number(dict, "topfill");
#endif
if (dict_has_key(dict, "leftcol"))
- curwin->w_leftcol = (colnr_T)dict_get_number(dict, (char_u *)"leftcol");
+ curwin->w_leftcol = (colnr_T)dict_get_number(dict, "leftcol");
if (dict_has_key(dict, "skipcol"))
- curwin->w_skipcol = (colnr_T)dict_get_number(dict, (char_u *)"skipcol");
+ curwin->w_skipcol = (colnr_T)dict_get_number(dict, "skipcol");
check_cursor();
win_new_height(curwin, curwin->w_height);
diff --git a/src/fileio.c b/src/fileio.c
index 2c6c3381c1..4287e8f6cd 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4746,8 +4746,8 @@ compare_readdirex_item(const void *p1, const void *p2)
{
char_u *name1, *name2;
- name1 = dict_get_string(*(dict_T**)p1, (char_u*)"name", FALSE);
- name2 = dict_get_string(*(dict_T**)p2, (char_u*)"name", FALSE);
+ name1 = dict_get_string(*(dict_T**)p1, "name", FALSE);
+ name2 = dict_get_string(*(dict_T**)p2, "name", FALSE);
if (readdirex_sort == READDIR_SORT_BYTE)
return STRCMP(name1, name2);
else if (readdirex_sort == READDIR_SORT_IC)
diff --git a/src/filepath.c b/src/filepath.c
index f1ae18e0bd..0867a51810 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1619,7 +1619,7 @@ readdirex_dict_arg(typval_T *tv, int *cmp)
}
if (dict_has_key(tv->vval.v_dict, "sort"))
- compare = dict_get_string(tv->vval.v_dict, (char_u *)"sort", FALSE);
+ compare = dict_get_string(tv->vval.v_dict, "sort", FALSE);
else
{
semsg(_(e_dictionary_key_str_required), "sort");
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 43fef8bd43..472cebf733 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -8549,7 +8549,7 @@ test_gui_w32_sendevent(dict_T *args)
char_u *event;
INPUT inputs[1];
- event = dict_get_string(args, (char_u *)"event", TRUE);
+ event = dict_get_string(args, "event", TRUE);
if (event == NULL)
return FALSE;
@@ -8559,7 +8559,7 @@ test_gui_w32_sendevent(dict_T *args)
{
WORD vkCode;
- vkCode = dict_get_number_def(args, (char_u *)"keycode", 0);
+ vkCode = dict_get_number_def(args, "keycode", 0);
if (vkCode <= 0 || vkCode >= 0xFF)
{
semsg(_(e_invalid_argument_nr), (long)vkCode);
diff --git a/src/highlight.c b/src/highlight.c
index 575451e705..2542c7b202 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -4317,8 +4317,7 @@ hldict_attr_to_str(
p = attr_str;
for (i = 0; i < (int)ARRAY_LENGTH(hl_name_table); i++)
{
- if (dict_get_bool(attrdict, (char_u *)hl_name_table[i],
- VVAL_FALSE) == VVAL_TRUE)
+ if (dict_get_bool(attrdict, hl_name_table[i], VVAL_FALSE) == VVAL_TRUE)
{
if (p != attr_str && (size_t)(p - attr_str + 2) < len)
STRCPY(p, (char_u *)",");
@@ -4398,10 +4397,10 @@ hlg_add_or_update(dict_T *dict)
if (name == NULL || *name == NUL || error)
return FALSE;
- if (dict_get_bool(dict, (char_u *)"force", VVAL_FALSE) == VVAL_TRUE)
+ if (dict_get_bool(dict, "force", VVAL_FALSE) == VVAL_TRUE)
forceit = TRUE;
- if (dict_get_bool(dict, (char_u *)"default", VVAL_FALSE) == VVAL_TRUE)
+ if (dict_get_bool(dict, "default", VVAL_FALSE) == VVAL_TRUE)
dodefault = TRUE;
if (dict_has_key(dict, "cleared"))
@@ -4409,7 +4408,7 @@ hlg_add_or_update(dict_T *dict)
varnumber_T cleared;
// clear a highlight group
- cleared = dict_get_bool(dict, (char_u *)"cleared", FALSE);
+ cleared = dict_get_bool(dict, "cleared", FALSE);
if (cleared == TRUE)
{
vim_snprintf((char *)hlsetBuf, HLSETBUFSZ, "clear %s", name);
diff --git a/src/insexpand.c b/src/insexpand.c
index c505158a1d..7339ce9c6e 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2767,25 +2767,21 @@ ins_compl_add_tv(typval_T *tv, int dir, int fast)
user_data.v_type = VAR_UNKNOWN;
if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
{
- word = dict_get_string(tv->vval.v_dict, (char_u *)"word", FALSE);
- cptext[CPT_ABBR] = dict_get_string(tv->vval.v_dict,
- (char_u *)"abbr", FALSE);
- cptext[CPT_MENU] = dict_get_string(tv->vval.v_dict,
- (char_u *)"menu", FALSE);
- cptext[CPT_KIND] = dict_get_string(tv->vval.v_dict,
- (char_u *)"kind", FALSE);
- cptext[CPT_INFO] = dict_get_string(tv->vval.v_dict,
- (char_u *)"info", FALSE);
- dict_get_tv(tv->vval.v_dict, (char_u *)"user_data", &user_data);
- if (dict_get_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL
- && dict_get_number(tv->vval.v_dict, (char_u *)"icase"))
+ word = dict_get_string(tv->vval.v_dict, "word", FALSE);
+ cptext[CPT_ABBR] = dict_get_string(tv->vval.v_dict, "abbr", FALSE);
+ cptext[CPT_MENU] = dict_get_string(tv->vval.v_dict, "menu", FALSE);
+ cptext[CPT_KIND] = dict_get_string(tv->vval.v_dict, "kind", FALSE);
+ cptext[CPT_INFO] = dict_get_string(tv->vval.v_dict, "info", FALSE);
+ dict_get_tv(tv->vval.v_dict, "user_data", &user_data);
+ if (dict_get_string(tv->vval.v_dict, "icase", FALSE) != NULL
+ && dict_get_number(tv->vval.v_dict, "icase"))
flags |= CP_ICASE;
- if (dict_get_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL)
- dup = dict_get_number(tv->vval.v_dict, (char_u *)"dup");
- if (dict_get_string(tv->vval.v_dict, (char_u *)"empty", FALSE) != NULL)
- empty = dict_get_number(tv->vval.v_dict, (char_u *)"empty");
- if (dict_get_string(tv->vval.v_dict, (char_u *)"equal", FALSE) != NULL
- && dict_get_number(tv->vval.v_dict, (char_u *)"equal"))
+ if (dict_get_string(tv->vval.v_dict, "dup", FALSE) != NULL)
+ dup = dict_get_number(tv->vval.v_dict, "dup");
+ if (dict_get_string(tv->vval.v_dict, "empty", FALSE) != NULL)
+ empty = dict_get_number(tv->vval.v_dict, "empty");
+ if (dict_get_string(tv->vval.v_dict, "equal", FALSE) != NULL
+ && dict_get_number(tv->vval.v_dict, "equal"))
flags |= CP_EQUAL;
}
else
diff --git a/src/map.c b/src/map.c
index ff4c4968da..96ccff02a2 100644
--- a/src/map.c
+++ b/src/map.c
@@ -2621,8 +2621,8 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
if (dict_only)
{
d = argvars[0].vval.v_dict;
- which = dict_get_string(d, (char_u *)"mode", FALSE);
- is_abbr = dict_get_bool(d, (char_u *)"abbr", -1);
+ which = dict_get_string(d, "mode", FALSE);
+ is_abbr = dict_get_bool(d, "abbr", -1);
if (which == NULL || is_abbr < 0)
{
emsg(_(e_entries_missing_in_mapset_dict_argument));
@@ -2652,10 +2652,10 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
// Get the values in the same order as above in get_maparg().
- lhs = dict_get_string(d, (char_u *)"lhs", FALSE);
- lhsraw = dict_get_string(d, (char_u *)"lhsraw", FALSE);
- lhsrawalt = dict_get_string(d, (char_u *)"lhsrawalt", FALSE);
- rhs = dict_get_string(d, (char_u *)"rhs", FALSE);
+ lhs = dict_get_string(d, "lhs", FALSE);
+ lhsraw = dict_get_string(d, "lhsraw", FALSE);
+ lhsrawalt = dict_get_string(d, "lhsrawalt", FALSE);
+ rhs = dict_get_string(d, "rhs", FALSE);
if (lhs == NULL || lhsraw == NULL || rhs == NULL)
{
emsg(_(e_entries_missing_in_mapset_dict_argument));
@@ -2665,16 +2665,16 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
rhs = replace_termcodes(rhs, &arg_buf,
REPTERM_DO_LT | REPTERM_SPECIAL, NULL);
- noremap = dict_get_number(d, (char_u *)"noremap") ? REMAP_NONE: 0;
- if (dict_get_number(d, (char_u *)"script") != 0)
+ noremap = dict_get_number(d, "noremap") ? REMAP_NONE: 0;
+ if (dict_get_number(d, "script") != 0)
noremap = REMAP_SCRIPT;
- expr = dict_get_number(d, (char_u *)"expr") != 0;
- silent = dict_get_number(d, (char_u *)"silent") != 0;
- sid = dict_get_number(d, (char_u *)"sid");
- scriptversion = dict_get_number(d, (char_u *)"scriptversion");
- lnum = dict_get_number(d, (char_u *)"lnum");
- buffer = dict_get_number(d, (char_u *)"buffer");
- nowait = dict_get_number(d, (char_u *)"nowait") != 0;
+ expr = dict_get_number(d, "expr") != 0;
+ silent = dict_get_number(d, "silent") != 0;
+ sid = dict_get_number(d, "sid");
+ scriptversion = dict_get_number(d, "scriptversion");
+ lnum = dict_get_number(d, "lnum");
+ buffer = dict_get_number(d, "buffer");
+ nowait = dict_get_number(d, "nowait") != 0;
// mode from the dict is not used
if (buffer)
diff --git a/src/match.c b/src/match.c
index c9231876bc..e58ad013cb 100644
--- a/src/match.c
+++ b/src/match.c
@@ -961,8 +961,7 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
}
if (dict_has_key(tv->vval.v_dict, "conceal"))
- *conceal_char = dict_get_string(tv->vval.v_dict,
- (char_u *)"conceal", FALSE);
+ *conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE);
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL)
{
@@ -1161,16 +1160,16 @@ f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
}
- group = dict_get_string(d, (char_u *)"group", TRUE);
- priority = (int)dict_get_number(d, (char_u *)"priority");
- id = (int)dict_get_number(d, (char_u *)"id");
+ group = dict_get_string(d, "group", TRUE);
+ priority = (int)dict_get_number(d, "priority");
+ id = (int)dict_get_number(d, "id");
conceal = dict_has_key(d, "conceal")
- ? dict_get_string(d, (char_u *)"conceal", TRUE)
+ ? dict_get_string(d, "conceal", TRUE)
: NULL;
if (i == 0)
{
match_add(win, group,
- dict_get_string(d, (char_u *)"pattern", FALSE),
+ dict_get_string(d, "pattern", FALSE),
priority, id, NULL, conceal);
}
else
diff --git a/src/popupwin.c b/src/popupwin.c
index dd87705504..78833400df 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -433,7 +433,7 @@ popup_add_timeout(win_T *wp, int time)
static poppos_T
get_pos_entry(dict_T *d, int give_error)
{
- char_u *str = dict_get_string(d, (char_u *)"pos", FALSE);
+ char_u *str = dict_get_string(d, "pos", FALSE);
int nr;
if (str == NULL)
@@ -458,13 +458,13 @@ apply_move_options(win_T *wp, dict_T *d)
char_u *str;
dictitem_T *di;
- if ((nr = dict_get_number_def(d, (char_u *)"minwidth", -1)) >= 0)
+ if ((nr = dict_get_number_def(d, "minwidth", -1)) >= 0)
wp->w_minwidth = nr;
- if ((nr = dict_get_number_def(d, (char_u *)"minheight", -1)) >= 0)
+ if ((nr = dict_get_number_def(d, "minheight", -1)) >= 0)
wp->w_minheight = nr;
- if ((nr = dict_get_number_def(d, (char_u *)"maxwidth", -1)) >= 0)
+ if ((nr = dict_get_number_def(d, "maxwidth", -1)) >= 0)
wp->w_maxwidth = nr;
- if ((nr = dict_get_number_def(d, (char_u *)"maxheight", -1)) >= 0)
+ if ((nr = dict_get_number_def(d, "maxheight", -1)) >= 0)
wp->w_maxheight = nr;
nr = popup_options_one(d, (char_u *)"line");
@@ -475,7 +475,7 @@ apply_move_options(win_T *wp, dict_T *d)
wp->w_wantcol = nr;
- nr = dict_get_bool(d, (char_u *)"fixed", -1);
+ nr = dict_get_bool(d, "fixed", -1);
if (nr != -1)
wp->w_popup_fixed = nr != 0;
@@ -486,7 +486,7 @@ apply_move_options(win_T *wp, dict_T *d)
wp->w_popup_pos = ppt;
}
- str = dict_get_string(d, (char_u *)"textprop", FALSE);
+ str = dict_get_string(d, "textprop", FALSE);
if (str != NULL)
{
wp->w_popup_prop_type = 0;
@@ -513,7 +513,7 @@ apply_move_options(win_T *wp, dict_T *d)
di = dict_find(d, (char_u *)"textpropid", -1);
if (di != NULL)
- wp->w_popup_prop_id = dict_get_number(d, (char_u *)"textpropid");
+ wp->w_popup_prop_id = dict_get_number(d, "textpropid");
}
/*
@@ -696,27 +696,27 @@ apply_general_options(win_T *wp, dict_T *dict)
di = dict_find(dict, (char_u *)"firstline", -1);
if (di != NULL)
{
- wp->w_firstline = dict_get_number(dict, (char_u *)"firstline");
+ wp->w_firstline = dict_get_number(dict, "firstline");
if (wp->w_firstline < 0)
wp->w_firstline = -1;
}
- nr = dict_get_bool(dict, (char_u *)"scrollbar", -1);
+ nr = dict_get_bool(dict, "scrollbar", -1);
if (nr != -1)
wp->w_want_scrollbar = nr;
- str = dict_get_string(dict, (char_u *)"title", FALSE);
+ str = dict_get_string(dict, "title", FALSE);
if (str != NULL)
{
vim_free(wp->w_popup_title);
wp->w_popup_title = vim_strsave(str);
}
- nr = dict_get_bool(dict, (char_u *)"wrap", -1);
+ nr = dict_get_bool(dict, "wrap", -1);
if (nr != -1)
wp->w_p_wrap = nr != 0;
- nr = dict_get_bool(dict, (char_u *)"drag", -1);
+ nr = dict_get_bool(dict, "drag", -1);
if (nr != -1)
{
if (nr)
@@ -724,7 +724,7 @@ apply_general_options(win_T *wp, dict_T *dict)
else
wp->w_popup_flags &= ~POPF_DRAG;
}
- nr = dict_get_bool(dict, (char_u *)"dragall", -1);
+ nr = dict_get_bool(dict, "dragall", -1);
if (nr != -1)
{
if (nr)
@@ -733,7 +733,7 @@ apply_general_options(win_T *wp, dict_T *dict)
wp->w_popup_flags &= ~POPF_DRAGALL;
}
- nr = dict_get_bool(dict, (char_u *)"posinvert", -1);
+ nr = dict_get_bool(dict, "posinvert", -1);
if (nr != -1)
{
if (nr)
@@ -742,7 +742,7 @@ apply_general_options(win_T *wp, dict_T *dict)
wp->w_popup_flags &= ~POPF_POSINVERT;
}
- nr = dict_get_bool(dict, (char_u *)"resize", -1);
+ nr = dict_get_bool(dict, "resize", -1);
if (nr != -1)
{
if (nr)
@@ -775,7 +775,7 @@ apply_general_options(win_T *wp, dict_T *dict)
semsg(_(e_invalid_value_for_argument_str_str), "close", tv_get_string(&di->di_tv));
}
- str = dict_get_string(dict, (char_u *)"highlight", FALSE);
+ str = dict_get_string(dict, "highlight", FALSE);
if (str != NULL)
{
set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1,
@@ -861,7 +861,7 @@ apply_general_options(win_T *wp, dict_T *dict)
di = dict_find(dict, (char_u *)"zindex", -1);
if (di != NULL)
{
- wp->w_zindex = dict_get_number(dict, (char_u *)"zindex");
+ wp->w_zindex = dict_get_number(dict, "zindex");
if (wp->w_zindex < 1)
wp->w_zindex = POPUPWIN_DEFAULT_ZINDEX;
if (wp->w_zindex > 32000)
@@ -903,7 +903,7 @@ apply_general_options(win_T *wp, dict_T *dict)
#if defined(FEAT_TIMERS)
// Add timer to close the popup after some time.
- nr = dict_get_number(dict, (char_u *)"time");
+ nr = dict_get_number(dict, "time");
if (nr > 0)
popup_add_timeout(wp, nr);
#endif
@@ -922,7 +922,7 @@ apply_general_options(win_T *wp, dict_T *dict)
handle_moved_argument(wp, di, TRUE);
}
- nr = dict_get_bool(dict, (char_u *)"cursorline", -1);
+ nr = dict_get_bool(dict, "cursorline", -1);
if (nr != -1)
{
if (nr != 0)
@@ -942,7 +942,7 @@ apply_general_options(win_T *wp, dict_T *dict)
set_callback(&wp->w_filter_cb, &callback);
}
}
- nr = dict_get_bool(dict, (char_u *)"mapping", -1);
+ nr = dict_get_bool(dict, "mapping", -1);
if (nr != -1)
{
if (nr)
@@ -951,7 +951,7 @@ apply_general_options(win_T *wp, dict_T *dict)
wp->w_popup_flags &= ~POPF_MAPPING;
}
- str = dict_get_string(dict, (char_u *)"filtermode", FALSE);
+ str = dict_get_string(dict, "filtermode", FALSE);
if (str != NULL)
{
if (STRCMP(str, "a") == 0)
@@ -990,7 +990,7 @@ apply_options(win_T *wp, dict_T *dict, int create)
apply_general_options(wp, dict);
- nr = dict_get_bool(dict, (char_u *)"hidden", FALSE);
+ nr = dict_get_bool(dict, "hidden", FALSE);
if (nr > 0)
wp->w_popup_flags |= POPF_HIDDEN | POPF_HIDDEN_FORCE;
@@ -1051,8 +1051,7 @@ add_popup_dicts(buf_T *buf, list_T *l)
return;
}
dict = li->li_tv.vval.v_dict;
- p = dict == NULL ? NULL
- : dict_get_string(dict, (char_u *)"text", FALSE);
+ p = dict == NULL ? NULL : dict_get_string(dict, "text", FALSE);
ml_append_buf(buf, lnum++,
p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE);
}
@@ -1086,7 +1085,7 @@ add_popup_dicts(buf_T *buf, list_T *l)
dict = pli->li_tv.vval.v_dict;
if (dict != NULL)
{
- int col = dict_get_number(dict, (char_u *)"col");
+ int col = dict_get_number(dict, "col");
prop_add_common( lnum, col, dict, buf, NULL);
}
@@ -1975,7 +1974,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
if (d != NULL)
{
if (dict_has_key(d, "tabpage"))
- tabnr = (int)dict_get_number(d, (char_u *)"tabpage");
+ tabnr = (int)dict_get_number(d, "tabpage");
else if (type == TYPE_NOTIFICATION)
tabnr = -1; // notifications are global by default
else
diff --git a/src/proto/dict.pro b/src/proto/dict.pro
index 30a3055841..a4442ccb9a 100644
--- a/src/proto/dict.pro
+++ b/src/proto/dict.pro
@@ -28,12 +28,12 @@ int dict_add_dict(dict_T *d, char *key, dict_T *dict);
long dict_len(dict_T *d);
dictitem_T *dict_find(dict_T *d, char_u *key, int len);
int dict_has_key(dict_T *d, char *key);
-int dict_get_tv(dict_T *d, char_u *key, typval_T *rettv);
-char_u *dict_get_string(dict_T *d, char_u *key, int save);
-varnumber_T dict_get_number(dict_T *d, char_u *key);
-varnumber_T dict_get_number_def(dict_T *d, char_u *key, int def);
+int dict_get_tv(dict_T *d, char *key, typval_T *rettv);
+char_u *dict_get_string(dict_T *d, char *key, int save);
+varnumber_T dict_get_number(dict_T *d, char *key);
+varnumber_T dict_get_number_def(dict_T *d, char *key, int def);
varnumber_T dict_get_number_check(dict_T *d, char_u *key);
-varnumber_T dict_get_bool(dict_T *d, char_u *key, int def);
+varnumber_T dict_get_bool(dict_T *d, char *key, int def);
char_u *dict2string(typval_T *tv, int copyID, int restore_copyID);
char_u *get_literal_key(char_u **arg);
int eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal);
diff --git a/src/quickfix.c b/src/quickfix.c
index c37caa50d4..49484e0602 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -7209,18 +7209,18 @@ qf_add_entry_from_dict(
if (first_entry)
did_bufnr_emsg = FALSE;
- filename = dict_get_string(d, (char_u *)"filename", TRUE);
- module = dict_get_string(d, (char_u *)"module", TRUE);
- bufnum = (int)dict_get_number(d, (char_u *)"bufnr");
- lnum = (int)dict_get_number(d, (char_u *)"lnum");
- end_lnum = (int)dict_get_number(d, (char_u *)"end_lnum");
- col = (int)dict_get_number(d, (char_u *)"col");
- end_col = (int)dict_get_number(d, (char_u *)"end_col");
- vcol = (int)dict_get_number(d, (char_u *)"vcol");
- nr = (int)dict_get_number(d, (char_u *)"nr");
- type = dict_get_string(d, (char_u *)"type", TRUE);
- pattern = dict_get_string(d, (char_u *)"pattern", TRUE);
- text = dict_get_string(d, (char_u *)"text", TRUE);
+ filename = dict_get_string(d, "filename", TRUE);
+ module = dict_get_string(d, "module", TRUE);
+ bufnum = (int)dict_get_number(d, "bufnr");
+ lnum = (int)dict_get_number(d, "lnum");
+ end_lnum = (int)dict_get_number(d, "end_lnum");
+ col = (int)dict_get_number(d, "col");
+ end_col = (int)dict_get_number(d, "end_col");
+ vcol = (int)dict_get_number(d, "vcol");
+ nr = (int)dict_get_number(d, "nr");
+ type = dict_get_string(d, "type", TRUE);
+ pattern = dict_get_string(d, "pattern", TRUE);
+ text = dict_get_string(d, "text", TRUE);
if (text == NULL)
text = vim_strsave((char_u *)"");
@@ -7243,7 +7243,7 @@ qf_add_entry_from_dict(
// If the 'valid' field is present it overrules the detected value.
if (dict_has_key(d, "valid"))
- valid = (int)dict_get_bool(d, (char_u *)"valid", FALSE);
+ valid = (int)dict_get_bool(d, "valid", FALSE);
status = qf_add_entry(qfl,
NULL, // dir
@@ -7419,7 +7419,7 @@ qf_setprop_title(qf_info_T *qi, int qf_idx, dict_T *what, dictitem_T *di)
return FAIL;
vim_free(qfl->qf_title);
- q