|
Karsten Hopp |
d1aaf1 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
d1aaf1 |
Subject: Patch 7.3.895
|
|
Karsten Hopp |
d1aaf1 |
Fcc: outbox
|
|
Karsten Hopp |
d1aaf1 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
d1aaf1 |
Mime-Version: 1.0
|
|
Karsten Hopp |
d1aaf1 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
d1aaf1 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
d1aaf1 |
------------
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
Patch 7.3.895
|
|
Karsten Hopp |
d1aaf1 |
Problem: Valgrind error in test 91. (Issue 128)
|
|
Karsten Hopp |
d1aaf1 |
Solution: Pass scope name to find_var_in_ht().
|
|
Karsten Hopp |
d1aaf1 |
Files: src/eval.c
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
*** ../vim-7.3.894/src/eval.c 2013-04-15 12:27:30.000000000 +0200
|
|
Karsten Hopp |
d1aaf1 |
--- src/eval.c 2013-04-15 13:00:44.000000000 +0200
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 788,794 ****
|
|
Karsten Hopp |
d1aaf1 |
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
|
|
Karsten Hopp |
d1aaf1 |
static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
|
|
Karsten Hopp |
d1aaf1 |
static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
|
|
Karsten Hopp |
d1aaf1 |
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, char_u *varname, int writing));
|
|
Karsten Hopp |
d1aaf1 |
static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
|
|
Karsten Hopp |
d1aaf1 |
static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
|
|
Karsten Hopp |
d1aaf1 |
static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
|
|
Karsten Hopp |
d1aaf1 |
--- 788,794 ----
|
|
Karsten Hopp |
d1aaf1 |
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
|
|
Karsten Hopp |
d1aaf1 |
static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
|
|
Karsten Hopp |
d1aaf1 |
static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
|
|
Karsten Hopp |
d1aaf1 |
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int writing));
|
|
Karsten Hopp |
d1aaf1 |
static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
|
|
Karsten Hopp |
d1aaf1 |
static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
|
|
Karsten Hopp |
d1aaf1 |
static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 11150,11162 ****
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
else
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
! if (*varname == NUL)
|
|
Karsten Hopp |
d1aaf1 |
! /* let getbufvar({nr}, "") return the "b:" dictionary. The
|
|
Karsten Hopp |
d1aaf1 |
! * scope prefix before the NUL byte is required by
|
|
Karsten Hopp |
d1aaf1 |
! * find_var_in_ht(). */
|
|
Karsten Hopp |
d1aaf1 |
! varname = (char_u *)"b:" + 2;
|
|
Karsten Hopp |
d1aaf1 |
! /* look up the variable */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&curbuf->b_vars->dv_hashtab, varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
--- 11150,11159 ----
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
else
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
! /* Look up the variable. */
|
|
Karsten Hopp |
d1aaf1 |
! /* Let getbufvar({nr}, "") return the "b:" dictionary. */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&curbuf->b_vars->dv_hashtab,
|
|
Karsten Hopp |
d1aaf1 |
! 'b', varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 11779,11785 ****
|
|
Karsten Hopp |
d1aaf1 |
if (tp != NULL && varname != NULL)
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
/* look up the variable */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&tp->tp_vars->dv_hashtab, varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
else if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
d1aaf1 |
--- 11776,11782 ----
|
|
Karsten Hopp |
d1aaf1 |
if (tp != NULL && varname != NULL)
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
/* look up the variable */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
else if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 11929,11941 ****
|
|
Karsten Hopp |
d1aaf1 |
get_option_tv(&varname, rettv, 1);
|
|
Karsten Hopp |
d1aaf1 |
else
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
! if (*varname == NUL)
|
|
Karsten Hopp |
d1aaf1 |
! /* let getwinvar({nr}, "") return the "w:" dictionary. The
|
|
Karsten Hopp |
d1aaf1 |
! * scope prefix before the NUL byte is required by
|
|
Karsten Hopp |
d1aaf1 |
! * find_var_in_ht(). */
|
|
Karsten Hopp |
d1aaf1 |
! varname = (char_u *)"w:" + 2;
|
|
Karsten Hopp |
d1aaf1 |
! /* look up the variable */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&win->w_vars->dv_hashtab, varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
--- 11926,11934 ----
|
|
Karsten Hopp |
d1aaf1 |
get_option_tv(&varname, rettv, 1);
|
|
Karsten Hopp |
d1aaf1 |
else
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
! /* Look up the variable. */
|
|
Karsten Hopp |
d1aaf1 |
! /* Let getwinvar({nr}, "") return the "w:" dictionary. */
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE);
|
|
Karsten Hopp |
d1aaf1 |
if (v != NULL)
|
|
Karsten Hopp |
d1aaf1 |
copy_tv(&v->di_tv, rettv);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 20041,20056 ****
|
|
Karsten Hopp |
d1aaf1 |
*htp = ht;
|
|
Karsten Hopp |
d1aaf1 |
if (ht == NULL)
|
|
Karsten Hopp |
d1aaf1 |
return NULL;
|
|
Karsten Hopp |
d1aaf1 |
! return find_var_in_ht(ht, varname, htp != NULL);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
/*
|
|
Karsten Hopp |
d1aaf1 |
! * Find variable "varname" in hashtab "ht".
|
|
Karsten Hopp |
d1aaf1 |
* Returns NULL if not found.
|
|
Karsten Hopp |
d1aaf1 |
*/
|
|
Karsten Hopp |
d1aaf1 |
static dictitem_T *
|
|
Karsten Hopp |
d1aaf1 |
! find_var_in_ht(ht, varname, writing)
|
|
Karsten Hopp |
d1aaf1 |
hashtab_T *ht;
|
|
Karsten Hopp |
d1aaf1 |
char_u *varname;
|
|
Karsten Hopp |
d1aaf1 |
int writing;
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
--- 20034,20050 ----
|
|
Karsten Hopp |
d1aaf1 |
*htp = ht;
|
|
Karsten Hopp |
d1aaf1 |
if (ht == NULL)
|
|
Karsten Hopp |
d1aaf1 |
return NULL;
|
|
Karsten Hopp |
d1aaf1 |
! return find_var_in_ht(ht, *name, varname, htp != NULL);
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
/*
|
|
Karsten Hopp |
d1aaf1 |
! * Find variable "varname" in hashtab "ht" with name "htname".
|
|
Karsten Hopp |
d1aaf1 |
* Returns NULL if not found.
|
|
Karsten Hopp |
d1aaf1 |
*/
|
|
Karsten Hopp |
d1aaf1 |
static dictitem_T *
|
|
Karsten Hopp |
d1aaf1 |
! find_var_in_ht(ht, htname, varname, writing)
|
|
Karsten Hopp |
d1aaf1 |
hashtab_T *ht;
|
|
Karsten Hopp |
d1aaf1 |
+ int htname;
|
|
Karsten Hopp |
d1aaf1 |
char_u *varname;
|
|
Karsten Hopp |
d1aaf1 |
int writing;
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 20059,20065 ****
|
|
Karsten Hopp |
d1aaf1 |
if (*varname == NUL)
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
/* Must be something like "s:", otherwise "ht" would be NULL. */
|
|
Karsten Hopp |
d1aaf1 |
! switch (varname[-2])
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
case 's': return &SCRIPT_SV(current_SID)->sv_var;
|
|
Karsten Hopp |
d1aaf1 |
case 'g': return &globvars_var;
|
|
Karsten Hopp |
d1aaf1 |
--- 20053,20059 ----
|
|
Karsten Hopp |
d1aaf1 |
if (*varname == NUL)
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
/* Must be something like "s:", otherwise "ht" would be NULL. */
|
|
Karsten Hopp |
d1aaf1 |
! switch (htname)
|
|
Karsten Hopp |
d1aaf1 |
{
|
|
Karsten Hopp |
d1aaf1 |
case 's': return &SCRIPT_SV(current_SID)->sv_var;
|
|
Karsten Hopp |
d1aaf1 |
case 'g': return &globvars_var;
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 20389,20395 ****
|
|
Karsten Hopp |
d1aaf1 |
EMSG2(_(e_illvar), name);
|
|
Karsten Hopp |
d1aaf1 |
return;
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(ht, varname, TRUE);
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL))
|
|
Karsten Hopp |
d1aaf1 |
return;
|
|
Karsten Hopp |
d1aaf1 |
--- 20383,20389 ----
|
|
Karsten Hopp |
d1aaf1 |
EMSG2(_(e_illvar), name);
|
|
Karsten Hopp |
d1aaf1 |
return;
|
|
Karsten Hopp |
d1aaf1 |
}
|
|
Karsten Hopp |
d1aaf1 |
! v = find_var_in_ht(ht, 0, varname, TRUE);
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL))
|
|
Karsten Hopp |
d1aaf1 |
return;
|
|
Karsten Hopp |
d1aaf1 |
*** ../vim-7.3.894/src/version.c 2013-04-15 12:36:14.000000000 +0200
|
|
Karsten Hopp |
d1aaf1 |
--- src/version.c 2013-04-15 13:04:54.000000000 +0200
|
|
Karsten Hopp |
d1aaf1 |
***************
|
|
Karsten Hopp |
d1aaf1 |
*** 730,731 ****
|
|
Karsten Hopp |
d1aaf1 |
--- 730,733 ----
|
|
Karsten Hopp |
d1aaf1 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
d1aaf1 |
+ /**/
|
|
Karsten Hopp |
d1aaf1 |
+ 895,
|
|
Karsten Hopp |
d1aaf1 |
/**/
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
--
|
|
Karsten Hopp |
d1aaf1 |
Very funny, Scotty. Now beam down my clothes.
|
|
Karsten Hopp |
d1aaf1 |
|
|
Karsten Hopp |
d1aaf1 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
d1aaf1 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
d1aaf1 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
d1aaf1 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|