Mercurial > vim
changeset 14303:f761a55a8aed v8.1.0167
patch 8.1.0167: lock flag in new dictitem is reset in many places
commit https://github.com/vim/vim/commit/c89d4b35300b98cf68b14c89c8e1add51bd857e3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 8 17:19:02 2018 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Jul 2018 17:30:06 +0200 |
parents | 35465f8b5195 |
children | 21ffe3de71b7 |
files | src/channel.c src/dict.c src/ex_cmds2.c src/if_perl.xs src/if_py_both.h src/userfunc.c src/version.c |
diffstat | 7 files changed, 7 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -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)
--- 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, va 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, ch 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 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 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;
--- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1524,7 +1524,6 @@ add_timer_info(typval_T *rettv, timer_T di->di_tv.v_type = VAR_FUNC; di->di_tv.vval.v_string = vim_strsave(timer->tr_callback); } - di->di_tv.v_lock = 0; } }
--- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -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);
--- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -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, 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 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, PyErr_NoMemory(); return -1; } - di->di_tv.v_lock = 0; if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1) {
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -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 */