Karsten Hopp 08a05f
To: vim_dev@googlegroups.com
Karsten Hopp 08a05f
Subject: Patch 7.4.154
Karsten Hopp 08a05f
Fcc: outbox
Karsten Hopp 08a05f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 08a05f
Mime-Version: 1.0
Karsten Hopp 08a05f
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 08a05f
Content-Transfer-Encoding: 8bit
Karsten Hopp 08a05f
------------
Karsten Hopp 08a05f
Karsten Hopp 08a05f
Patch 7.4.154 (after 7.4.149)
Karsten Hopp 08a05f
Problem:    Still a problem with auto-loading.
Karsten Hopp 08a05f
Solution:   Pass no_autoload to deref_func_name(). (Yukihiro Nakadaira)
Karsten Hopp 08a05f
Files:	    src/eval.c
Karsten Hopp 08a05f
Karsten Hopp 08a05f
Karsten Hopp 08a05f
*** ../vim-7.4.153/src/eval.c	2014-01-14 16:36:40.000000000 +0100
Karsten Hopp 08a05f
--- src/eval.c	2014-01-14 19:40:36.000000000 +0100
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 447,453 ****
Karsten Hopp 08a05f
  #endif
Karsten Hopp 08a05f
  static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
Karsten Hopp 08a05f
  static int find_internal_func __ARGS((char_u *name));
Karsten Hopp 08a05f
! static char_u *deref_func_name __ARGS((char_u *name, int *lenp));
Karsten Hopp 08a05f
  static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
Karsten Hopp 08a05f
  static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
Karsten Hopp 08a05f
  static void emsg_funcname __ARGS((char *ermsg, char_u *name));
Karsten Hopp 08a05f
--- 447,453 ----
Karsten Hopp 08a05f
  #endif
Karsten Hopp 08a05f
  static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
Karsten Hopp 08a05f
  static int find_internal_func __ARGS((char_u *name));
Karsten Hopp 08a05f
! static char_u *deref_func_name __ARGS((char_u *name, int *lenp, int no_autoload));
Karsten Hopp 08a05f
  static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
Karsten Hopp 08a05f
  static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
Karsten Hopp 08a05f
  static void emsg_funcname __ARGS((char *ermsg, char_u *name));
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 3432,3438 ****
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      /* If it is the name of a variable of type VAR_FUNC use its contents. */
Karsten Hopp 08a05f
      len = (int)STRLEN(tofree);
Karsten Hopp 08a05f
!     name = deref_func_name(tofree, &len;;
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      /* Skip white space to allow ":call func ()".  Not good, but required for
Karsten Hopp 08a05f
       * backward compatibility. */
Karsten Hopp 08a05f
--- 3432,3438 ----
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      /* If it is the name of a variable of type VAR_FUNC use its contents. */
Karsten Hopp 08a05f
      len = (int)STRLEN(tofree);
Karsten Hopp 08a05f
!     name = deref_func_name(tofree, &len, FALSE);
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      /* Skip white space to allow ":call func ()".  Not good, but required for
Karsten Hopp 08a05f
       * backward compatibility. */
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 5159,5165 ****
Karsten Hopp 08a05f
  	    {
Karsten Hopp 08a05f
  		/* If "s" is the name of a variable of type VAR_FUNC
Karsten Hopp 08a05f
  		 * use its contents. */
Karsten Hopp 08a05f
! 		s = deref_func_name(s, &len;;
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
  		/* Invoke the function. */
Karsten Hopp 08a05f
  		ret = get_func_tv(s, len, rettv, arg,
Karsten Hopp 08a05f
--- 5159,5165 ----
Karsten Hopp 08a05f
  	    {
Karsten Hopp 08a05f
  		/* If "s" is the name of a variable of type VAR_FUNC
Karsten Hopp 08a05f
  		 * use its contents. */
Karsten Hopp 08a05f
! 		s = deref_func_name(s, &len, FALSE);
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
  		/* Invoke the function. */
Karsten Hopp 08a05f
  		ret = get_func_tv(s, len, rettv, arg,
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 8291,8306 ****
Karsten Hopp 08a05f
   * name it contains, otherwise return "name".
Karsten Hopp 08a05f
   */
Karsten Hopp 08a05f
      static char_u *
Karsten Hopp 08a05f
! deref_func_name(name, lenp)
Karsten Hopp 08a05f
      char_u	*name;
Karsten Hopp 08a05f
      int		*lenp;
Karsten Hopp 08a05f
  {
Karsten Hopp 08a05f
      dictitem_T	*v;
Karsten Hopp 08a05f
      int		cc;
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      cc = name[*lenp];
Karsten Hopp 08a05f
      name[*lenp] = NUL;
Karsten Hopp 08a05f
!     v = find_var(name, NULL, FALSE);
Karsten Hopp 08a05f
      name[*lenp] = cc;
Karsten Hopp 08a05f
      if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
--- 8291,8307 ----
Karsten Hopp 08a05f
   * name it contains, otherwise return "name".
Karsten Hopp 08a05f
   */
Karsten Hopp 08a05f
      static char_u *
Karsten Hopp 08a05f
! deref_func_name(name, lenp, no_autoload)
Karsten Hopp 08a05f
      char_u	*name;
Karsten Hopp 08a05f
      int		*lenp;
Karsten Hopp 08a05f
+     int		no_autoload;
Karsten Hopp 08a05f
  {
Karsten Hopp 08a05f
      dictitem_T	*v;
Karsten Hopp 08a05f
      int		cc;
Karsten Hopp 08a05f
  
Karsten Hopp 08a05f
      cc = name[*lenp];
Karsten Hopp 08a05f
      name[*lenp] = NUL;
Karsten Hopp 08a05f
!     v = find_var(name, NULL, no_autoload);
Karsten Hopp 08a05f
      name[*lenp] = cc;
Karsten Hopp 08a05f
      if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 21947,21960 ****
Karsten Hopp 08a05f
      if (lv.ll_exp_name != NULL)
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
  	len = (int)STRLEN(lv.ll_exp_name);
Karsten Hopp 08a05f
! 	name = deref_func_name(lv.ll_exp_name, &len;;
Karsten Hopp 08a05f
  	if (name == lv.ll_exp_name)
Karsten Hopp 08a05f
  	    name = NULL;
Karsten Hopp 08a05f
      }
Karsten Hopp 08a05f
      else
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
  	len = (int)(end - *pp);
Karsten Hopp 08a05f
! 	name = deref_func_name(*pp, &len;;
Karsten Hopp 08a05f
  	if (name == *pp)
Karsten Hopp 08a05f
  	    name = NULL;
Karsten Hopp 08a05f
      }
Karsten Hopp 08a05f
--- 21948,21961 ----
Karsten Hopp 08a05f
      if (lv.ll_exp_name != NULL)
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
  	len = (int)STRLEN(lv.ll_exp_name);
Karsten Hopp 08a05f
! 	name = deref_func_name(lv.ll_exp_name, &len, flags & TFN_NO_AUTOLOAD);
Karsten Hopp 08a05f
  	if (name == lv.ll_exp_name)
Karsten Hopp 08a05f
  	    name = NULL;
Karsten Hopp 08a05f
      }
Karsten Hopp 08a05f
      else
Karsten Hopp 08a05f
      {
Karsten Hopp 08a05f
  	len = (int)(end - *pp);
Karsten Hopp 08a05f
! 	name = deref_func_name(*pp, &len, flags & TFN_NO_AUTOLOAD);
Karsten Hopp 08a05f
  	if (name == *pp)
Karsten Hopp 08a05f
  	    name = NULL;
Karsten Hopp 08a05f
      }
Karsten Hopp 08a05f
*** ../vim-7.4.153/src/version.c	2014-01-14 19:35:49.000000000 +0100
Karsten Hopp 08a05f
--- src/version.c	2014-01-14 19:42:05.000000000 +0100
Karsten Hopp 08a05f
***************
Karsten Hopp 08a05f
*** 740,741 ****
Karsten Hopp 08a05f
--- 740,743 ----
Karsten Hopp 08a05f
  {   /* Add new patch number below this line */
Karsten Hopp 08a05f
+ /**/
Karsten Hopp 08a05f
+     154,
Karsten Hopp 08a05f
  /**/
Karsten Hopp 08a05f
Karsten Hopp 08a05f
-- 
Karsten Hopp 08a05f
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 08a05f
162. You go outside and look for a brightness knob to turn down the sun.
Karsten Hopp 08a05f
Karsten Hopp 08a05f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 08a05f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 08a05f
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 08a05f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///