Hi Jim!
Thanks for the fixes, please install (in the maint branch
preferably). Beware that this patch (2/3) already includes
a parse-gram.c regen part that should be part of 3/3. Also:
Le 3 mai 2012 à 23:18, Jim Meyering a écrit :
> diff --git a/src/parse-gram.y b/src/parse-gram.y
> index 2cf436b..916b70d 100644
> --- a/src/parse-gram.y
> +++ b/src/parse-gram.y
> @@ -783,9 +783,7 @@ add_param (param_type type, char *decl, location loc)
> name_len++)
> continue;
>
> - name = xmalloc (name_len + 1);
> - memcpy (name, name_start, name_len);
> - name[name_len] = '\0';
> + name = xstrdup (name_start);
> if (type & param_lex)
> muscle_pair_list_grow ("lex_param", decl, name);
> if (type & param_parse)
This does not seem right: you no longer take name_len
into account. The full context is:
{
char *name;
size_t name_len;
for (name_len = 1;
memchr (alphanum, name_start[name_len], sizeof alphanum);
name_len++)
continue;
name = xmalloc (name_len + 1);
memcpy (name, name_start, name_len);
name[name_len] = '\0';
muscle_pair_list_grow (type, decl, name);
free (name);
}
Actually, I don't understand why we don't use strspn instead of
the for-loop.