0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2018-07-08 17:19:02 +02:00
parent e0be167a80
commit c89d4b3530
7 changed files with 7 additions and 16 deletions

View File

@@ -5742,7 +5742,6 @@ job_info(job_T *job, dict_T *dict)
item = dictitem_alloc((char_u *)"channel");
if (item == NULL)
return;
item->di_tv.v_lock = 0;
item->di_tv.v_type = VAR_CHANNEL;
item->di_tv.vval.v_channel = job->jv_channel;
if (job->jv_channel != NULL)

View File

@@ -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;

View File

@@ -1524,7 +1524,6 @@ 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->tr_callback);
}
di->di_tv.v_lock = 0;
}
}

View File

@@ -1200,10 +1200,8 @@ perl_to_vim(SV *sv, typval_T *rettv)
if ((item = dictitem_alloc((char_u *)key)) == NULL)
break;
item->di_tv.v_type = VAR_NUMBER;
item->di_tv.v_lock = 0;
item->di_tv.vval.v_number = 0;
item->di_tv.v_type = VAR_NUMBER;
item->di_tv.vval.v_number = 0;
if (dict_add(dict, item) == FAIL) {
dictitem_free(item);

View File

@@ -1832,7 +1832,6 @@ DictionaryAssItem(
PyErr_NoMemory();
return -1;
}
di->di_tv.v_lock = 0;
di->di_tv.v_type = VAR_UNKNOWN;
if (dict_add(dict, di) == FAIL)
@@ -2038,7 +2037,6 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
PyErr_NoMemory();
return NULL;
}
di->di_tv.v_lock = 0;
di->di_tv.v_type = VAR_UNKNOWN;
valObject = PySequence_Fast_GET_ITEM(fast, 1);
@@ -5852,7 +5850,6 @@ pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
dict_unref(dict);
return -1;
}
di->di_tv.v_lock = 0;
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
@@ -5950,7 +5947,6 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
PyErr_NoMemory();
return -1;
}
di->di_tv.v_lock = 0;
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{

View File

@@ -2390,7 +2390,6 @@ ex_function(exarg_T *eap)
/* overwrite existing dict entry */
clear_tv(&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 */

View File

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