aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-22 05:58:58 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-23 18:17:09 -0400
commitbb02ca6defb65110a426b579e81cd1a6f9eb886a (patch)
treeadfa04eac49a91c20cdeb1bbb5cd8720d37aca75
parent98801ec7aea199b80373d1dc072021a98db63a8b (diff)
downloadrneovim-bb02ca6defb65110a426b579e81cd1a6f9eb886a.tar.gz
rneovim-bb02ca6defb65110a426b579e81cd1a6f9eb886a.tar.bz2
rneovim-bb02ca6defb65110a426b579e81cd1a6f9eb886a.zip
vim-patch:8.1.0167: lock flag in new dictitem is reset in many places
Problem: Lock flag in new dictitem is reset in many places. Solution: Always reset the lock flag. https://github.com/vim/vim/commit/c89d4b35300b98cf68b14c89c8e1add51bd857e3
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/eval/typval.c12
2 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 3e6e183847..ce0b192545 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -17819,7 +17819,6 @@ static void add_timer_info(typval_T *rettv, timer_T *timer)
di->di_tv.v_type = VAR_FUNC;
di->di_tv.vval.v_string = vim_strsave(timer->callback.data.funcref);
}
- di->di_tv.v_lock = 0;
}
static void add_timer_info_all(typval_T *rettv)
@@ -21180,7 +21179,6 @@ void ex_function(exarg_T *eap)
tv_clear(&fudi.fd_di->di_tv);
}
fudi.fd_di->di_tv.v_type = VAR_FUNC;
- fudi.fd_di->di_tv.v_lock = 0;
fudi.fd_di->di_tv.vval.v_string = vim_strsave(name);
/* behave like "dict" was used */
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index ffb46abfea..91a1d083c7 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1221,7 +1221,8 @@ void tv_dict_watcher_notify(dict_T *const dict, const char *const key,
/// Allocate a dictionary 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.
///
/// @param[in] key Key, is copied to the new item.
/// @param[in] key_len Key length.
@@ -1235,12 +1236,14 @@ dictitem_T *tv_dict_item_alloc_len(const char *const key, const size_t key_len)
memcpy(di->di_key, key, key_len);
di->di_key[key_len] = NUL;
di->di_flags = DI_FLAGS_ALLOC;
+ di->di_tv.v_lock = VAR_UNLOCKED;
return di;
}
/// Allocate a dictionary 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.
///
/// @param[in] key Key, is copied to the new item.
///
@@ -1572,7 +1575,6 @@ int tv_dict_add_list(dict_T *const d, const char *const key,
{
dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
- item->di_tv.v_lock = VAR_UNLOCKED;
item->di_tv.v_type = VAR_LIST;
item->di_tv.vval.v_list = list;
tv_list_ref(list);
@@ -1597,7 +1599,6 @@ int tv_dict_add_dict(dict_T *const d, const char *const key,
{
dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
- item->di_tv.v_lock = VAR_UNLOCKED;
item->di_tv.v_type = VAR_DICT;
item->di_tv.vval.v_dict = dict;
dict->dv_refcount++;
@@ -1621,7 +1622,6 @@ int tv_dict_add_nr(dict_T *const d, const char *const key,
{
dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
- item->di_tv.v_lock = VAR_UNLOCKED;
item->di_tv.v_type = VAR_NUMBER;
item->di_tv.vval.v_number = nr;
if (tv_dict_add(d, item) == FAIL) {
@@ -1644,7 +1644,6 @@ int tv_dict_add_special(dict_T *const d, const char *const key,
{
dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
- item->di_tv.v_lock = VAR_UNLOCKED;
item->di_tv.v_type = VAR_SPECIAL;
item->di_tv.vval.v_special = val;
if (tv_dict_add(d, item) == FAIL) {
@@ -1706,7 +1705,6 @@ int tv_dict_add_allocated_str(dict_T *const d,
{
dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
- item->di_tv.v_lock = VAR_UNLOCKED;
item->di_tv.v_type = VAR_STRING;
item->di_tv.vval.v_string = (char_u *)val;
if (tv_dict_add(d, item) == FAIL) {