diff options
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/dict.c b/src/dict.c index e1f7fa23e8..c359e6f0f6 100644 --- a/src/dict.c +++ b/src/dict.c @@ -188,7 +188,8 @@ dict_free_items(int copyID) /* * Allocate a Dictionary item. * The "key" is copied to the new item. - * Note that the value of the item "di_tv" still needs to be initialized! + * Note that the type and value of the item "di_tv" still needs to be + * initialized! * Returns NULL when out of memory. */ dictitem_T * @@ -201,6 +202,7 @@ dictitem_alloc(char_u *key) { STRCPY(di->di_key, key); di->di_flags = DI_FLAGS_ALLOC; + di->di_tv.v_lock = 0; } return di; } @@ -338,7 +340,6 @@ dict_add_number(dict_T *d, char *key, varnumber_T nr) item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_NUMBER; item->di_tv.vval.v_number = nr; if (dict_add(d, item) == FAIL) @@ -361,7 +362,6 @@ dict_add_string(dict_T *d, char *key, char_u *str) item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_STRING; item->di_tv.vval.v_string = str != NULL ? vim_strsave(str) : NULL; if (dict_add(d, item) == FAIL) @@ -384,7 +384,6 @@ dict_add_list(dict_T *d, char *key, list_T *list) item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_LIST; item->di_tv.vval.v_list = list; ++list->lv_refcount; @@ -408,7 +407,6 @@ dict_add_dict(dict_T *d, char *key, dict_T *dict) item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_DICT; item->di_tv.vval.v_dict = dict; ++dict->dv_refcount; |