Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.2.005
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.005
Problem:    A few problems when profiling.  Using flag pointer instead of flag
            value.  Allocating zero bytes.  Not freeing used memory.
Solution:   Remove wrong '&' characters.  Skip dumping when there is nothing
            to dump.  Free used memory. (Dominique Pelle)
Files:      src/eval.c


*** ../vim-7.2.004/src/eval.c	Fri Aug  8 12:36:31 2008
--- src/eval.c	Mon Aug 25 04:40:11 2008
***************
*** 3657,3664 ****
  }
  
  /*
!  * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
!  * it refers to a List or Dictionary that is locked.
   */
      static int
  tv_islocked(tv)
--- 3657,3664 ----
  }
  
  /*
!  * Return TRUE if typeval "tv" is locked: Either that value is locked itself
!  * or it refers to a List or Dictionary that is locked.
   */
      static int
  tv_islocked(tv)
***************
*** 15838,15847 ****
      if (res == FAIL)
  	res = ITEM_COMPARE_FAIL;
      else
- 	/* return value has wrong type */
  	res = get_tv_number_chk(&rettv, &item_compare_func_err);
      if (item_compare_func_err)
! 	res = ITEM_COMPARE_FAIL;
      clear_tv(&rettv);
      return res;
  }
--- 15838,15846 ----
      if (res == FAIL)
  	res = ITEM_COMPARE_FAIL;
      else
  	res = get_tv_number_chk(&rettv, &item_compare_func_err);
      if (item_compare_func_err)
! 	res = ITEM_COMPARE_FAIL;  /* return value has wrong type */
      clear_tv(&rettv);
      return res;
  }
***************
*** 20590,20595 ****
--- 20589,20597 ----
      int		st_len = 0;
  
      todo = (int)func_hashtab.ht_used;
+     if (todo == 0)
+ 	return;     /* nothing to dump */
+ 
      sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
  
      for (hi = func_hashtab.ht_array; todo > 0; ++hi)
***************
*** 20638,20643 ****
--- 20640,20647 ----
  							      prof_self_cmp);
  	prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
      }
+ 
+     vim_free(sorttab);
  }
  
      static void
***************
*** 21204,21210 ****
  	if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
  	    func_do_profile(fp);
  	if (fp->uf_profiling
! 		       || (fc.caller != NULL && &fc.caller->func->uf_profiling))
  	{
  	    ++fp->uf_tm_count;
  	    profile_start(&call_start);
--- 21208,21214 ----
  	if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
  	    func_do_profile(fp);
  	if (fp->uf_profiling
! 		       || (fc.caller != NULL && fc.caller->func->uf_profiling))
  	{
  	    ++fp->uf_tm_count;
  	    profile_start(&call_start);
***************
*** 21235,21247 ****
  
  #ifdef FEAT_PROFILE
      if (do_profiling == PROF_YES && (fp->uf_profiling
! 		    || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
      {
  	profile_end(&call_start);
  	profile_sub_wait(&wait_start, &call_start);
  	profile_add(&fp->uf_tm_total, &call_start);
  	profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
! 	if (fc.caller != NULL && &fc.caller->func->uf_profiling)
  	{
  	    profile_add(&fc.caller->func->uf_tm_children, &call_start);
  	    profile_add(&fc.caller->func->uf_tml_children, &call_start);
--- 21239,21251 ----
  
  #ifdef FEAT_PROFILE
      if (do_profiling == PROF_YES && (fp->uf_profiling
! 		    || (fc.caller != NULL && fc.caller->func->uf_profiling)))
      {
  	profile_end(&call_start);
  	profile_sub_wait(&wait_start, &call_start);
  	profile_add(&fp->uf_tm_total, &call_start);
  	profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
! 	if (fc.caller != NULL && fc.caller->func->uf_profiling)
  	{
  	    profile_add(&fc.caller->func->uf_tm_children, &call_start);
  	    profile_add(&fc.caller->func->uf_tml_children, &call_start);
*** ../vim-7.2.004/src/version.c	Mon Aug 25 04:35:13 2008
--- src/version.c	Mon Aug 25 04:46:44 2008
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     5,
  /**/

-- 
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
				(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///