summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-11 16:05:23 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-11 16:05:23 +0100
commit9b4a15d5dba354d2e1e02871470bad103f34769a (patch)
treee5e49ad3182e07e641cdea0e04c4a8078186c58c /src/dict.c
parente05a89ac6399a8c7d164c99fdab6841d999a9128 (diff)
downloadvim-git-9b4a15d5dba354d2e1e02871470bad103f34769a.tar.gz
patch 8.2.0111: VAR_SPECIAL is also used for booleansv8.2.0111
Problem: VAR_SPECIAL is also used for booleans. Solution: Add VAR_BOOL for better type checking.
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dict.c b/src/dict.c
index a9a909bc2..f3f352167 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -345,14 +345,14 @@ dict_add(dict_T *d, dictitem_T *item)
* Returns FAIL when out of memory and when key already exists.
*/
static int
-dict_add_number_special(dict_T *d, char *key, varnumber_T nr, int special)
+dict_add_number_special(dict_T *d, char *key, varnumber_T nr, vartype_T vartype)
{
dictitem_T *item;
item = dictitem_alloc((char_u *)key);
if (item == NULL)
return FAIL;
- item->di_tv.v_type = special ? VAR_SPECIAL : VAR_NUMBER;
+ item->di_tv.v_type = vartype;
item->di_tv.vval.v_number = nr;
if (dict_add(d, item) == FAIL)
{
@@ -369,7 +369,7 @@ dict_add_number_special(dict_T *d, char *key, varnumber_T nr, int special)
int
dict_add_number(dict_T *d, char *key, varnumber_T nr)
{
- return dict_add_number_special(d, key, nr, FALSE);
+ return dict_add_number_special(d, key, nr, VAR_NUMBER);
}
/*
@@ -377,9 +377,9 @@ dict_add_number(dict_T *d, char *key, varnumber_T nr)
* Returns FAIL when out of memory and when key already exists.
*/
int
-dict_add_special(dict_T *d, char *key, varnumber_T nr)
+dict_add_bool(dict_T *d, char *key, varnumber_T nr)
{
- return dict_add_number_special(d, key, nr, TRUE);
+ return dict_add_number_special(d, key, nr, VAR_BOOL);
}
/*