summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2010-06-12 20:12:02 +0200
committerBram Moolenaar <bram@vim.org>2010-06-12 20:12:02 +0200
commit6d5bcdaac6703f560164032270e4ab5fe37a51ec (patch)
tree02bd3e9da197305d9efb1123936bc29b80c73d20
parent316e190a5284138549011605a303c49029a816ac (diff)
downloadvim-6d5bcdaac6703f560164032270e4ab5fe37a51ec.tar.gz
updated for version 7.2.443v7.2.443
Problem: Using taglist() on a tag file with duplicate fields generates an internal error. (Peter Odding) Solution: Check for duplicate field names.
-rw-r--r--src/eval.c3
-rw-r--r--src/proto/eval.pro1
-rw-r--r--src/tag.c14
-rw-r--r--src/version.c2
4 files changed, 17 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index 1114c95f..32e3d203 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -451,7 +451,6 @@ static dictitem_T *dictitem_copy __ARGS((dictitem_T *org));
static void dictitem_remove __ARGS((dict_T *dict, dictitem_T *item));
static dict_T *dict_copy __ARGS((dict_T *orig, int deep, int copyID));
static long dict_len __ARGS((dict_T *d));
-static dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
static char_u *dict2string __ARGS((typval_T *tv, int copyID));
static int get_dict_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static char_u *echo_string __ARGS((typval_T *tv, char_u **tofree, char_u *numbuf, int copyID));
@@ -7012,7 +7011,7 @@ dict_len(d)
* If "len" is negative use strlen(key).
* Returns NULL when not found.
*/
- static dictitem_T *
+ dictitem_T *
dict_find(d, key, len)
dict_T *d;
char_u *key;
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index e817769e..6d11d970 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -56,6 +56,7 @@ dictitem_T *dictitem_alloc __ARGS((char_u *key));
void dictitem_free __ARGS((dictitem_T *item));
int dict_add __ARGS((dict_T *d, dictitem_T *item));
int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
+dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
long get_dict_number __ARGS((dict_T *d, char_u *key));
char_u *get_function_name __ARGS((expand_T *xp, int idx));
diff --git a/src/tag.c b/src/tag.c
index ba36de73..db00c2e1 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -3771,7 +3771,8 @@ expand_tags(tagnames, pat, num_file, file)
static int add_tag_field __ARGS((dict_T *dict, char *field_name, char_u *start, char_u *end));
/*
- * Add a tag field to the dictionary "dict"
+ * Add a tag field to the dictionary "dict".
+ * Return OK or FAIL.
*/
static int
add_tag_field(dict, field_name, start, end)
@@ -3783,6 +3784,17 @@ add_tag_field(dict, field_name, start, end)
char_u buf[MAXPATHL];
int len = 0;
+ /* check that the field name doesn't exist yet */
+ if (dict_find(dict, (char_u *)field_name, -1) != NULL)
+ {
+ if (p_verbose > 0)
+ {
+ verbose_enter();
+ smsg((char_u *)_("Duplicate field name: %s"), field_name);
+ verbose_leave();
+ }
+ return FAIL;
+ }
if (start != NULL)
{
if (end == NULL)
diff --git a/src/version.c b/src/version.c
index 856230a5..89adc48c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -682,6 +682,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 443,
+/**/
442,
/**/
441,