mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #5835 from lonerover/vim-7.4.1847
vim-patch:7.4.1847
This commit is contained in:
commit
3b793d0453
@ -5162,12 +5162,18 @@ dict_equal (
|
|||||||
dictitem_T *item2;
|
dictitem_T *item2;
|
||||||
int todo;
|
int todo;
|
||||||
|
|
||||||
if (d1 == NULL || d2 == NULL)
|
if (d1 == NULL && d2 == NULL) {
|
||||||
return FALSE;
|
return true;
|
||||||
if (d1 == d2)
|
}
|
||||||
return TRUE;
|
if (d1 == NULL || d2 == NULL) {
|
||||||
if (dict_len(d1) != dict_len(d2))
|
return false;
|
||||||
return FALSE;
|
}
|
||||||
|
if (d1 == d2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (dict_len(d1) != dict_len(d2)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
todo = (int)d1->dv_hashtab.ht_used;
|
todo = (int)d1->dv_hashtab.ht_used;
|
||||||
for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) {
|
for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) {
|
||||||
@ -6669,9 +6675,12 @@ dictitem_T *dict_find(dict_T *d, char_u *key, int len)
|
|||||||
char_u *tofree = NULL;
|
char_u *tofree = NULL;
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
|
|
||||||
if (len < 0)
|
if (d == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (len < 0) {
|
||||||
akey = key;
|
akey = key;
|
||||||
else if (len >= AKEYLEN) {
|
} else if (len >= AKEYLEN) {
|
||||||
tofree = akey = vim_strnsave(key, len);
|
tofree = akey = vim_strnsave(key, len);
|
||||||
} else {
|
} else {
|
||||||
/* Avoid a malloc/free by using buf[]. */
|
/* Avoid a malloc/free by using buf[]. */
|
||||||
@ -10067,7 +10076,7 @@ static void f_getbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
} else if (STRCMP(varname, "changedtick") == 0) {
|
} else if (STRCMP(varname, "changedtick") == 0) {
|
||||||
rettv->v_type = VAR_NUMBER;
|
rettv->v_type = VAR_NUMBER;
|
||||||
rettv->vval.v_number = curbuf->b_changedtick;
|
rettv->vval.v_number = curbuf->b_changedtick;
|
||||||
done = TRUE;
|
done = true;
|
||||||
} else {
|
} else {
|
||||||
/* Look up the variable. */
|
/* Look up the variable. */
|
||||||
/* Let getbufvar({nr}, "") return the "b:" dictionary. */
|
/* Let getbufvar({nr}, "") return the "b:" dictionary. */
|
||||||
@ -15516,7 +15525,10 @@ static void f_setreg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argvars[1].v_type == VAR_LIST) {
|
if (argvars[1].v_type == VAR_LIST) {
|
||||||
int len = argvars[1].vval.v_list->lv_len;
|
list_T *ll = argvars[1].vval.v_list;
|
||||||
|
// If the list is NULL handle like an empty list.
|
||||||
|
int len = ll == NULL ? 0 : ll->lv_len;
|
||||||
|
|
||||||
// First half: use for pointers to result lines; second half: use for
|
// First half: use for pointers to result lines; second half: use for
|
||||||
// pointers to allocated copies.
|
// pointers to allocated copies.
|
||||||
char_u **lstval = xmalloc(sizeof(char_u *) * ((len + 1) * 2));
|
char_u **lstval = xmalloc(sizeof(char_u *) * ((len + 1) * 2));
|
||||||
@ -15525,7 +15537,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
char_u **curallocval = allocval;
|
char_u **curallocval = allocval;
|
||||||
|
|
||||||
char_u buf[NUMBUFLEN];
|
char_u buf[NUMBUFLEN];
|
||||||
for (listitem_T *li = argvars[1].vval.v_list->lv_first;
|
for (listitem_T *li = ll == NULL ? NULL : ll->lv_first;
|
||||||
li != NULL;
|
li != NULL;
|
||||||
li = li->li_next) {
|
li = li->li_next) {
|
||||||
char_u *strval = get_tv_string_buf_chk(&li->li_tv, buf);
|
char_u *strval = get_tv_string_buf_chk(&li->li_tv, buf);
|
||||||
|
@ -81,3 +81,14 @@ func Test_loop_over_null_list()
|
|||||||
call assert_true(0, 'should not get here')
|
call assert_true(0, 'should not get here')
|
||||||
endfor
|
endfor
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_compare_null_dict()
|
||||||
|
call assert_fails('let x = v:_null_dict[10]')
|
||||||
|
call assert_equal({}, {})
|
||||||
|
call assert_equal(v:_null_dict, v:_null_dict)
|
||||||
|
call assert_notequal({}, v:_null_dict)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_set_reg_null_list()
|
||||||
|
call setreg('x', v:_null_list)
|
||||||
|
endfunc
|
||||||
|
@ -593,7 +593,7 @@ static int included_patches[] = {
|
|||||||
// 1850 NA
|
// 1850 NA
|
||||||
// 1849 NA
|
// 1849 NA
|
||||||
// 1848 NA
|
// 1848 NA
|
||||||
// 1847,
|
1847,
|
||||||
// 1846 NA
|
// 1846 NA
|
||||||
// 1845 NA
|
// 1845 NA
|
||||||
// 1844 NA
|
// 1844 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user