lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
6c20e51
To: vim-dev@vim.org
6c20e51
Subject: Patch 7.2.443
6c20e51
Fcc: outbox
6c20e51
From: Bram Moolenaar <Bram@moolenaar.net>
6c20e51
Mime-Version: 1.0
6c20e51
Content-Type: text/plain; charset=UTF-8
6c20e51
Content-Transfer-Encoding: 8bit
6c20e51
------------
6c20e51
6c20e51
Patch 7.2.443 
6c20e51
Problem:    Using taglist() on a tag file with duplicate fields generates an 
6c20e51
            internal error. (Peter Odding) 
6c20e51
Solution:   Check for duplicate field names. 
6c20e51
Files:      src/eval.c, src/proto/eval.pro, src/tag.c 
6c20e51
6c20e51
6c20e51
*** ../vim-7.2.442/src/eval.c	2010-05-28 22:06:41.000000000 +0200
6c20e51
--- src/eval.c	2010-06-12 19:59:09.000000000 +0200
6c20e51
***************
6c20e51
*** 451,457 ****
6c20e51
  static void dictitem_remove __ARGS((dict_T *dict, dictitem_T *item));
6c20e51
  static dict_T *dict_copy __ARGS((dict_T *orig, int deep, int copyID));
6c20e51
  static long dict_len __ARGS((dict_T *d));
6c20e51
- static dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
6c20e51
  static char_u *dict2string __ARGS((typval_T *tv, int copyID));
6c20e51
  static int get_dict_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
6c20e51
  static char_u *echo_string __ARGS((typval_T *tv, char_u **tofree, char_u *numbuf, int copyID));
6c20e51
--- 451,456 ----
6c20e51
***************
6c20e51
*** 7012,7018 ****
6c20e51
   * If "len" is negative use strlen(key).
6c20e51
   * Returns NULL when not found.
6c20e51
   */
6c20e51
!     static dictitem_T *
6c20e51
  dict_find(d, key, len)
6c20e51
      dict_T	*d;
6c20e51
      char_u	*key;
6c20e51
--- 7011,7017 ----
6c20e51
   * If "len" is negative use strlen(key).
6c20e51
   * Returns NULL when not found.
6c20e51
   */
6c20e51
!     dictitem_T *
6c20e51
  dict_find(d, key, len)
6c20e51
      dict_T	*d;
6c20e51
      char_u	*key;
6c20e51
*** ../vim-7.2.442/src/proto/eval.pro	2010-01-19 15:51:29.000000000 +0100
6c20e51
--- src/proto/eval.pro	2010-06-12 19:59:13.000000000 +0200
6c20e51
***************
6c20e51
*** 56,61 ****
6c20e51
--- 56,62 ----
6c20e51
  void dictitem_free __ARGS((dictitem_T *item));
6c20e51
  int dict_add __ARGS((dict_T *d, dictitem_T *item));
6c20e51
  int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
6c20e51
+ dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
6c20e51
  char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
6c20e51
  long get_dict_number __ARGS((dict_T *d, char_u *key));
6c20e51
  char_u *get_function_name __ARGS((expand_T *xp, int idx));
6c20e51
*** ../vim-7.2.442/src/tag.c	2010-02-24 14:46:58.000000000 +0100
6c20e51
--- src/tag.c	2010-06-12 20:01:45.000000000 +0200
6c20e51
***************
6c20e51
*** 3771,3777 ****
6c20e51
  static int add_tag_field __ARGS((dict_T *dict, char *field_name, char_u *start, char_u *end));
6c20e51
  
6c20e51
  /*
6c20e51
!  * Add a tag field to the dictionary "dict"
6c20e51
   */
6c20e51
      static int
6c20e51
  add_tag_field(dict, field_name, start, end)
6c20e51
--- 3771,3778 ----
6c20e51
  static int add_tag_field __ARGS((dict_T *dict, char *field_name, char_u *start, char_u *end));
6c20e51
  
6c20e51
  /*
6c20e51
!  * Add a tag field to the dictionary "dict".
6c20e51
!  * Return OK or FAIL.
6c20e51
   */
6c20e51
      static int
6c20e51
  add_tag_field(dict, field_name, start, end)
6c20e51
***************
6c20e51
*** 3783,3788 ****
6c20e51
--- 3784,3800 ----
6c20e51
      char_u	buf[MAXPATHL];
6c20e51
      int		len = 0;
6c20e51
  
6c20e51
+     /* check that the field name doesn't exist yet */
6c20e51
+     if (dict_find(dict, (char_u *)field_name, -1) != NULL)
6c20e51
+     {
6c20e51
+ 	if (p_verbose > 0)
6c20e51
+ 	{
6c20e51
+ 	    verbose_enter();
6c20e51
+ 	    smsg((char_u *)_("Duplicate field name: %s"), field_name);
6c20e51
+ 	    verbose_leave();
6c20e51
+ 	}
6c20e51
+ 	return FAIL;
6c20e51
+     }
6c20e51
      if (start != NULL)
6c20e51
      {
6c20e51
  	if (end == NULL)
6c20e51
*** ../vim-7.2.442/src/version.c	2010-06-05 12:49:40.000000000 +0200
6c20e51
--- src/version.c	2010-06-12 20:05:27.000000000 +0200
6c20e51
***************
6c20e51
*** 683,684 ****
6c20e51
--- 683,686 ----
6c20e51
  {   /* Add new patch number below this line */
6c20e51
+ /**/
6c20e51
+     443,
6c20e51
  /**/
6c20e51
6c20e51
-- 
6c20e51
hundred-and-one symptoms of being an internet addict:
6c20e51
191. You rate eating establishments not by the quality of the food,
6c20e51
     but by the availability of electrical outlets for your PowerBook.
6c20e51
6c20e51
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
6c20e51
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
6c20e51
\\\        download, build and distribute -- http://www.A-A-P.org        ///
6c20e51
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///