Merge pull request #5358 from jbradaric/vim-7.4.1679

vim-patch:7.4.{1648,1679,1681}
This commit is contained in:
James McCoy 2016-09-28 20:35:29 -04:00 committed by GitHub
commit 724675061c
3 changed files with 20 additions and 8 deletions

View File

@ -292,8 +292,8 @@ typedef enum {
.vv_di = { \ .vv_di = { \
.di_tv = { .v_type = type }, \ .di_tv = { .v_type = type }, \
.di_flags = 0, \ .di_flags = 0, \
.di_key = { 0 }, \
}, \ }, \
.vv_filler = { 0 }, \
.vv_flags = flags, \ .vv_flags = flags, \
} }
@ -303,8 +303,7 @@ typedef enum {
// variables with the VV_ defines. // variables with the VV_ defines.
static struct vimvar { static struct vimvar {
char *vv_name; ///< Name of the variable, without v:. char *vv_name; ///< Name of the variable, without v:.
dictitem_T vv_di; ///< Value of the variable, with name. dictitem16_T vv_di; ///< Value and name for key (max 16 chars)
char vv_filler[16]; ///< Space for longest name from below.
char vv_flags; ///< Flags: #VV_COMPAT, #VV_RO, #VV_RO_SBX. char vv_flags; ///< Flags: #VV_COMPAT, #VV_RO, #VV_RO_SBX.
} vimvars[] = } vimvars[] =
{ {
@ -514,6 +513,7 @@ void eval_init(void)
for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) { for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) {
p = &vimvars[i]; p = &vimvars[i];
assert(STRLEN(p->vv_name) <= 16);
STRCPY(p->vv_di.di_key, p->vv_name); STRCPY(p->vv_di.di_key, p->vv_name);
if (p->vv_flags & VV_RO) if (p->vv_flags & VV_RO)
p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
@ -4952,7 +4952,8 @@ static list_T *rettv_list_alloc(typval_T *rettv)
list_T *l = list_alloc(); list_T *l = list_alloc();
rettv->vval.v_list = l; rettv->vval.v_list = l;
rettv->v_type = VAR_LIST; rettv->v_type = VAR_LIST;
++l->lv_refcount; rettv->v_lock = VAR_UNLOCKED;
l->lv_refcount++;
return l; return l;
} }
@ -6132,7 +6133,8 @@ static void rettv_dict_alloc(typval_T *rettv)
rettv->vval.v_dict = d; rettv->vval.v_dict = d;
rettv->v_type = VAR_DICT; rettv->v_type = VAR_DICT;
++d->dv_refcount; rettv->v_lock = VAR_UNLOCKED;
d->dv_refcount++;
} }
/// Clear all the keys of a Dictionary. "d" remains a valid empty Dictionary. /// Clear all the keys of a Dictionary. "d" remains a valid empty Dictionary.

View File

@ -114,6 +114,16 @@ struct dictitem_S {
typedef struct dictitem_S dictitem_T; typedef struct dictitem_S dictitem_T;
/// A dictitem with a 16 character key (plus NUL)
struct dictitem16_S {
typval_T di_tv; ///< type and value of the variable
char_u di_flags; ///< flags (only used for variable)
char_u di_key[17]; ///< key
};
typedef struct dictitem16_S dictitem16_T;
#define DI_FLAGS_RO 1 // "di_flags" value: read-only variable #define DI_FLAGS_RO 1 // "di_flags" value: read-only variable
#define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox #define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox
#define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove() #define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove()

View File

@ -762,9 +762,9 @@ static int included_patches[] = {
// 1684 NA // 1684 NA
// 1683 NA // 1683 NA
1682, 1682,
// 1681, 1681,
// 1680 NA // 1680 NA
// 1679, 1679,
// 1678 NA // 1678 NA
// 1677 NA // 1677 NA
1676, 1676,
@ -795,7 +795,7 @@ static int included_patches[] = {
// 1651 NA // 1651 NA
// 1650, // 1650,
1649, 1649,
// 1648, 1648,
// 1647, // 1647,
// 1646 NA // 1646 NA
// 1645, // 1645,