1
0
forked from aniani/vim

patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()

Problem:    Using illogical name for get_dict_number()/get_dict_string().
Solution:   Rename to start with dict_.
This commit is contained in:
Bram Moolenaar
2018-12-14 15:38:31 +01:00
parent fb95e212a2
commit 8f66717a1f
10 changed files with 68 additions and 66 deletions

View File

@@ -487,7 +487,7 @@ dict_find(dict_T *d, char_u *key, int len)
* Returns NULL if the entry doesn't exist or out of memory.
*/
char_u *
get_dict_string(dict_T *d, char_u *key, int save)
dict_get_string(dict_T *d, char_u *key, int save)
{
dictitem_T *di;
char_u *s;
@@ -506,7 +506,7 @@ get_dict_string(dict_T *d, char_u *key, int save)
* Returns 0 if the entry doesn't exist.
*/
varnumber_T
get_dict_number(dict_T *d, char_u *key)
dict_get_number(dict_T *d, char_u *key)
{
dictitem_T *di;
@@ -583,7 +583,7 @@ dict2string(typval_T *tv, int copyID, int restore_copyID)
* Return OK or FAIL. Returns NOTDONE for {expr}.
*/
int
get_dict_tv(char_u **arg, typval_T *rettv, int evaluate)
dict_get_tv(char_u **arg, typval_T *rettv, int evaluate)
{
dict_T *d = NULL;
typval_T tvkey;

View File

@@ -4343,23 +4343,23 @@ ins_compl_add_tv(typval_T *tv, int dir)
if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
{
word = get_dict_string(tv->vval.v_dict, (char_u *)"word", FALSE);
cptext[CPT_ABBR] = get_dict_string(tv->vval.v_dict,
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] = get_dict_string(tv->vval.v_dict,
cptext[CPT_MENU] = dict_get_string(tv->vval.v_dict,
(char_u *)"menu", FALSE);
cptext[CPT_KIND] = get_dict_string(tv->vval.v_dict,
cptext[CPT_KIND] = dict_get_string(tv->vval.v_dict,
(char_u *)"kind", FALSE);
cptext[CPT_INFO] = get_dict_string(tv->vval.v_dict,
cptext[CPT_INFO] = dict_get_string(tv->vval.v_dict,
(char_u *)"info", FALSE);
cptext[CPT_USER_DATA] = get_dict_string(tv->vval.v_dict,
cptext[CPT_USER_DATA] = dict_get_string(tv->vval.v_dict,
(char_u *)"user_data", FALSE);
if (get_dict_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL)
icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase");
if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL)
adup = get_dict_number(tv->vval.v_dict, (char_u *)"dup");
if (get_dict_string(tv->vval.v_dict, (char_u *)"empty", FALSE) != NULL)
aempty = get_dict_number(tv->vval.v_dict, (char_u *)"empty");
if (dict_get_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL)
icase = dict_get_number(tv->vval.v_dict, (char_u *)"icase");
if (dict_get_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL)
adup = dict_get_number(tv->vval.v_dict, (char_u *)"dup");
if (dict_get_string(tv->vval.v_dict, (char_u *)"empty", FALSE) != NULL)
aempty = dict_get_number(tv->vval.v_dict, (char_u *)"empty");
}
else
{

View File

@@ -4063,7 +4063,7 @@ eval7(
*/
case '{': ret = get_lambda_tv(arg, rettv, evaluate);
if (ret == NOTDONE)
ret = get_dict_tv(arg, rettv, evaluate);
ret = dict_get_tv(arg, rettv, evaluate);
break;
/*

View File

@@ -8072,7 +8072,7 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
}
if (dict_find(tv->vval.v_dict, (char_u *)"conceal", -1) != NULL)
*conceal_char = get_dict_string(tv->vval.v_dict,
*conceal_char = dict_get_string(tv->vval.v_dict,
(char_u *)"conceal", FALSE);
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL)
@@ -10668,7 +10668,7 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED)
if ((d = argvars[0].vval.v_dict) != NULL)
{
csearch = get_dict_string(d, (char_u *)"char", FALSE);
csearch = dict_get_string(d, (char_u *)"char", FALSE);
if (csearch != NULL)
{
#ifdef FEAT_MBYTE
@@ -10922,16 +10922,16 @@ f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
}
group = get_dict_string(d, (char_u *)"group", TRUE);
priority = (int)get_dict_number(d, (char_u *)"priority");
id = (int)get_dict_number(d, (char_u *)"id");
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");
conceal = dict_find(d, (char_u *)"conceal", -1) != NULL
? get_dict_string(d, (char_u *)"conceal", TRUE)
? dict_get_string(d, (char_u *)"conceal", TRUE)
: NULL;
if (i == 0)
{
match_add(curwin, group,
get_dict_string(d, (char_u *)"pattern", FALSE),
dict_get_string(d, (char_u *)"pattern", FALSE),
priority, id, NULL, conceal);
}
else
@@ -13529,7 +13529,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
return;
}
if (dict_find(dict, (char_u *)"repeat", -1) != NULL)
repeat = get_dict_number(dict, (char_u *)"repeat");
repeat = dict_get_number(dict, (char_u *)"repeat");
}
callback = get_callback(&argvars[1], &partial);
@@ -14080,29 +14080,29 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED)
else
{
if (dict_find(dict, (char_u *)"lnum", -1) != NULL)
curwin->w_cursor.lnum = (linenr_T)get_dict_number(dict, (char_u *)"lnum");
curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u *)"lnum");
if (dict_find(dict, (char_u *)"col", -1) != NULL)
curwin->w_cursor.col = (colnr_T)get_dict_number(dict, (char_u *)"col");
curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u *)"col");
#ifdef FEAT_VIRTUALEDIT
if (dict_find(dict, (char_u *)"coladd", -1) != NULL)
curwin->w_cursor.coladd = (colnr_T)get_dict_number(dict, (char_u *)"coladd");
curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u *)"coladd");
#endif
if (dict_find(dict, (char_u *)"curswant", -1) != NULL)
{
curwin->w_curswant = (colnr_T)get_dict_number(dict, (char_u *)"curswant");
curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u *)"curswant");
curwin->w_set_curswant = FALSE;
}
if (dict_find(dict, (char_u *)"topline", -1) != NULL)
set_topline(curwin, (linenr_T)get_dict_number(dict, (char_u *)"topline"));
set_topline(curwin, (linenr_T)dict_get_number(dict, (char_u *)"topline"));
#ifdef FEAT_DIFF
if (dict_find(dict, (char_u *)"topfill", -1) != NULL)
curwin->w_topfill = (int)get_dict_number(dict, (char_u *)"topfill");
curwin->w_topfill = (int)dict_get_number(dict, (char_u *)"topfill");
#endif
if (dict_find(dict, (char_u *)"leftcol", -1) != NULL)
curwin->w_leftcol = (colnr_T)get_dict_number(dict, (char_u *)"leftcol");
curwin->w_leftcol = (colnr_T)dict_get_number(dict, (char_u *)"leftcol");
if (dict_find(dict, (char_u *)"skipcol", -1) != NULL)
curwin->w_skipcol = (colnr_T)get_dict_number(dict, (char_u *)"skipcol");
curwin->w_skipcol = (colnr_T)dict_get_number(dict, (char_u *)"skipcol");
check_cursor();
win_new_height(curwin, curwin->w_height);

View File

@@ -19,10 +19,10 @@ int dict_add_list(dict_T *d, char *key, list_T *list);
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);
char_u *get_dict_string(dict_T *d, char_u *key, int save);
varnumber_T get_dict_number(dict_T *d, char_u *key);
char_u *dict_get_string(dict_T *d, char_u *key, int save);
varnumber_T dict_get_number(dict_T *d, char_u *key);
char_u *dict2string(typval_T *tv, int copyID, int restore_copyID);
int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate);
int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate);
void dict_extend(dict_T *d1, dict_T *d2, char_u *action);
dictitem_T *dict_lookup(hashitem_T *hi);
int dict_equal(dict_T *d1, dict_T *d2, int ic, int recursive);

View File

@@ -6258,16 +6258,16 @@ qf_add_entry_from_dict(
if (first_entry)
did_bufnr_emsg = FALSE;
filename = get_dict_string(d, (char_u *)"filename", TRUE);
module = get_dict_string(d, (char_u *)"module", TRUE);
bufnum = (int)get_dict_number(d, (char_u *)"bufnr");
lnum = (int)get_dict_number(d, (char_u *)"lnum");
col = (int)get_dict_number(d, (char_u *)"col");
vcol = (int)get_dict_number(d, (char_u *)"vcol");
nr = (int)get_dict_number(d, (char_u *)"nr");
type = get_dict_string(d, (char_u *)"type", TRUE);
pattern = get_dict_string(d, (char_u *)"pattern", TRUE);
text = get_dict_string(d, (char_u *)"text", TRUE);
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");
col = (int)dict_get_number(d, (char_u *)"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);
if (text == NULL)
text = vim_strsave((char_u *)"");
@@ -6290,7 +6290,7 @@ qf_add_entry_from_dict(
// If the 'valid' field is present it overrules the detected value.
if ((dict_find(d, (char_u *)"valid", -1)) != NULL)
valid = (int)get_dict_number(d, (char_u *)"valid");
valid = (int)dict_get_number(d, (char_u *)"valid");
status = qf_add_entry(qi,
qf_idx,
@@ -6456,7 +6456,7 @@ qf_setprop_title(qf_info_T *qi, int qf_idx, dict_T *what, dictitem_T *di)
return FAIL;
vim_free(qfl->qf_title);
qfl->qf_title = get_dict_string(what, (char_u *)"title", TRUE);
qfl->qf_title = dict_get_string(what, (char_u *)"title", TRUE);
if (qf_idx == qi->qf_curlist)
qf_update_win_titlevar(qi);

View File

@@ -4160,14 +4160,14 @@ tagstack_push_items(win_T *wp, list_T *l)
if (list2fpos(&di->di_tv, &mark, &fnum, NULL) != OK)
continue;
if ((tagname =
get_dict_string(itemdict, (char_u *)"tagname", TRUE)) == NULL)
dict_get_string(itemdict, (char_u *)"tagname", TRUE)) == NULL)
continue;
if (mark.col > 0)
mark.col--;
tagstack_push_item(wp, tagname,
(int)get_dict_number(itemdict, (char_u *)"bufnr"),
(int)get_dict_number(itemdict, (char_u *)"matchnr") - 1,
(int)dict_get_number(itemdict, (char_u *)"bufnr"),
(int)dict_get_number(itemdict, (char_u *)"matchnr") - 1,
mark, fnum);
}
}

View File

@@ -3523,9 +3523,9 @@ handle_drop_command(listitem_T *item)
dict_T *dict = opt_item->li_tv.vval.v_dict;
char_u *p;
p = get_dict_string(dict, (char_u *)"ff", FALSE);
p = dict_get_string(dict, (char_u *)"ff", FALSE);
if (p == NULL)
p = get_dict_string(dict, (char_u *)"fileformat", FALSE);
p = dict_get_string(dict, (char_u *)"fileformat", FALSE);
if (p != NULL)
{
if (check_ff_value(p) == FAIL)
@@ -3533,9 +3533,9 @@ handle_drop_command(listitem_T *item)
else
ea.force_ff = *p;
}
p = get_dict_string(dict, (char_u *)"enc", FALSE);
p = dict_get_string(dict, (char_u *)"enc", FALSE);
if (p == NULL)
p = get_dict_string(dict, (char_u *)"encoding", FALSE);
p = dict_get_string(dict, (char_u *)"encoding", FALSE);
if (p != NULL)
{
ea.cmd = alloc((int)STRLEN(p) + 12);
@@ -3547,7 +3547,7 @@ handle_drop_command(listitem_T *item)
}
}
p = get_dict_string(dict, (char_u *)"bad", FALSE);
p = dict_get_string(dict, (char_u *)"bad", FALSE);
if (p != NULL)
get_bad_opt(p, &ea);
@@ -3915,8 +3915,8 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
d = argvars[2].vval.v_dict;
if (d != NULL)
{
max_height = get_dict_number(d, (char_u *)"rows");
max_width = get_dict_number(d, (char_u *)"columns");
max_height = dict_get_number(d, (char_u *)"rows");
max_width = dict_get_number(d, (char_u *)"columns");
}
}

View File

@@ -173,7 +173,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
EMSG(_("E965: missing property type name"));
return;
}
type_name = get_dict_string(dict, (char_u *)"type", FALSE);
type_name = dict_get_string(dict, (char_u *)"type", FALSE);
if (dict_find(dict, (char_u *)"end_lnum", -1) != NULL)
{
@@ -183,10 +183,10 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
}
if (dict_find(dict, (char_u *)"length", -1) != NULL)
length = get_dict_number(dict, (char_u *)"length");
length = dict_get_number(dict, (char_u *)"length");
else if (dict_find(dict, (char_u *)"end_col", -1) != NULL)
{
length = get_dict_number(dict, (char_u *)"end_col") - col;
length = dict_get_number(dict, (char_u *)"end_col") - col;
if (length <= 0)
{
EMSG2(_(e_invargval), "end_col");
@@ -195,7 +195,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
}
if (dict_find(dict, (char_u *)"id", -1) != NULL)
id = get_dict_number(dict, (char_u *)"id");
id = dict_get_number(dict, (char_u *)"id");
if (get_bufnr_from_arg(&argvars[2], &buf) == FAIL)
return;
@@ -265,7 +265,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
/*
* Return TRUE if any text properties are defined globally or for buffer
* 'buf".
* "buf".
*/
int
has_any_text_properties(buf_T *buf)
@@ -498,13 +498,13 @@ f_prop_remove(typval_T *argvars, typval_T *rettv)
di = dict_find(dict, (char_u*)"all", -1);
if (di != NULL)
do_all = get_dict_number(dict, (char_u *)"all");
do_all = dict_get_number(dict, (char_u *)"all");
if (dict_find(dict, (char_u *)"id", -1) != NULL)
id = get_dict_number(dict, (char_u *)"id");
id = dict_get_number(dict, (char_u *)"id");
if (dict_find(dict, (char_u *)"type", -1))
{
char_u *name = get_dict_string(dict, (char_u *)"type", FALSE);
char_u *name = dict_get_string(dict, (char_u *)"type", FALSE);
proptype_T *type = lookup_prop_type(name, buf);
if (type == NULL)
@@ -642,7 +642,7 @@ prop_type_set(typval_T *argvars, int add)
char_u *highlight;
int hl_id = 0;
highlight = get_dict_string(dict, (char_u *)"highlight", FALSE);
highlight = dict_get_string(dict, (char_u *)"highlight", FALSE);
if (highlight != NULL && *highlight != NUL)
hl_id = syn_name2id(highlight);
if (hl_id <= 0)

View File

@@ -799,6 +799,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
583,
/**/
582,
/**/