mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.2141
Problem: Coverity reports bogus NULL check.
Solution: When checking for a variable in the funccal scope don't pass the
varname.
ba96e9af38
This commit is contained in:
parent
e71e9020eb
commit
42727ecf08
@ -3035,7 +3035,7 @@ int do_unlet(char_u *name, int forceit)
|
|||||||
}
|
}
|
||||||
hi = hash_find(ht, varname);
|
hi = hash_find(ht, varname);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
hi = find_hi_in_scoped_ht(name, &varname, &ht);
|
hi = find_hi_in_scoped_ht(name, &ht);
|
||||||
}
|
}
|
||||||
if (hi != NULL && !HASHITEM_EMPTY(hi)) {
|
if (hi != NULL && !HASHITEM_EMPTY(hi)) {
|
||||||
di = HI2DI(hi);
|
di = HI2DI(hi);
|
||||||
@ -20009,8 +20009,7 @@ static dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search in parent scope for lambda
|
// Search in parent scope for lambda
|
||||||
return find_var_in_scoped_ht(name, varname ? &varname : NULL,
|
return find_var_in_scoped_ht(name, no_autoload || htp != NULL);
|
||||||
no_autoload || htp != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find variable "varname" in hashtab "ht" with name "htname".
|
/// Find variable "varname" in hashtab "ht" with name "htname".
|
||||||
@ -20381,7 +20380,7 @@ set_var (
|
|||||||
|
|
||||||
// Search in parent scope which is possible to reference from lambda
|
// Search in parent scope which is possible to reference from lambda
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
v = find_var_in_scoped_ht(name, varname ? &varname : NULL, true);
|
v = find_var_in_scoped_ht(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL)
|
if ((tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL)
|
||||||
@ -23079,12 +23078,12 @@ static var_flavour_T var_flavour(char_u *varname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Search hashitem in parent scope.
|
/// Search hashitem in parent scope.
|
||||||
hashitem_T *find_hi_in_scoped_ht(char_u *name, char_u **varname,
|
hashitem_T *find_hi_in_scoped_ht(char_u *name, hashtab_T **pht)
|
||||||
hashtab_T **pht)
|
|
||||||
{
|
{
|
||||||
funccall_T *old_current_funccal = current_funccal;
|
funccall_T *old_current_funccal = current_funccal;
|
||||||
hashtab_T *ht;
|
hashtab_T *ht;
|
||||||
hashitem_T *hi = NULL;
|
hashitem_T *hi = NULL;
|
||||||
|
char_u *varname;
|
||||||
|
|
||||||
if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) {
|
if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -23093,9 +23092,9 @@ hashitem_T *find_hi_in_scoped_ht(char_u *name, char_u **varname,
|
|||||||
// Search in parent scope which is possible to reference from lambda
|
// Search in parent scope which is possible to reference from lambda
|
||||||
current_funccal = current_funccal->func->uf_scoped;
|
current_funccal = current_funccal->func->uf_scoped;
|
||||||
while (current_funccal != NULL) {
|
while (current_funccal != NULL) {
|
||||||
ht = find_var_ht(name, varname);
|
ht = find_var_ht(name, &varname);
|
||||||
if (ht != NULL && **varname != NUL) {
|
if (ht != NULL && *varname != NUL) {
|
||||||
hi = hash_find(ht, *varname);
|
hi = hash_find(ht, varname);
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (!HASHITEM_EMPTY(hi)) {
|
||||||
*pht = ht;
|
*pht = ht;
|
||||||
break;
|
break;
|
||||||
@ -23112,12 +23111,12 @@ hashitem_T *find_hi_in_scoped_ht(char_u *name, char_u **varname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Search variable in parent scope.
|
/// Search variable in parent scope.
|
||||||
dictitem_T *find_var_in_scoped_ht(char_u *name, char_u **varname,
|
dictitem_T *find_var_in_scoped_ht(char_u *name, int no_autoload)
|
||||||
int no_autoload)
|
|
||||||
{
|
{
|
||||||
dictitem_T *v = NULL;
|
dictitem_T *v = NULL;
|
||||||
funccall_T *old_current_funccal = current_funccal;
|
funccall_T *old_current_funccal = current_funccal;
|
||||||
hashtab_T *ht;
|
hashtab_T *ht;
|
||||||
|
char_u *varname;
|
||||||
|
|
||||||
if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) {
|
if (current_funccal == NULL || current_funccal->func->uf_scoped == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -23126,10 +23125,9 @@ dictitem_T *find_var_in_scoped_ht(char_u *name, char_u **varname,
|
|||||||
// Search in parent scope which is possible to reference from lambda
|
// Search in parent scope which is possible to reference from lambda
|
||||||
current_funccal = current_funccal->func->uf_scoped;
|
current_funccal = current_funccal->func->uf_scoped;
|
||||||
while (current_funccal) {
|
while (current_funccal) {
|
||||||
ht = find_var_ht(name, varname ? &(*varname) : NULL);
|
ht = find_var_ht(name, &varname);
|
||||||
if (ht != NULL) {
|
if (ht != NULL && *varname != NUL) {
|
||||||
v = find_var_in_ht(ht, *name,
|
v = find_var_in_ht(ht, *name, varname, no_autoload);
|
||||||
varname ? *varname : NULL, no_autoload);
|
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ static int included_patches[] = {
|
|||||||
// 2144,
|
// 2144,
|
||||||
// 2143,
|
// 2143,
|
||||||
// 2142,
|
// 2142,
|
||||||
// 2141,
|
2141,
|
||||||
// 2140 NA
|
// 2140 NA
|
||||||
2139,
|
2139,
|
||||||
// 2138 NA
|
// 2138 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user