Re: [RFA] "constify" parse_exp_1

Pedro Alves
2013-03-08T00:22:35Z

On 03/08/2013 12:09 AM, Keith Seitz wrote:
> --- ada-lang.c 5 Mar 2013 21:15:34 -0000 1.394
> +++ ada-lang.c 7 Mar 2013 22:59:29 -0000
> @@ -4057,13 +4057,14 @@ ada_read_renaming_var_value (struct symb
> struct block *block)
> {
> char *sym_name;
> + const char *sname;
> struct expression *expr;
> struct value *value;
> struct cleanup *old_chain = NULL;
>
> - sym_name = xstrdup (SYMBOL_LINKAGE_NAME (renaming_sym));
> + sname = sym_name = xstrdup (SYMBOL_LINKAGE_NAME (renaming_sym));
> old_chain = make_cleanup (xfree, sym_name);
> - expr = parse_exp_1 (&sym_name, 0, block, 0);
> + expr = parse_exp_1 (&sname, 0, block, 0);
> make_cleanup (free_current_contents, &expr);
> value = evaluate_expression (expr);
>

I didn't get past the first hunk in the patch. :-)

The xstrdup seemed to be there _because_ parse_exp_1
changed the input string. It seems it can be removed now.
Your patch seems to make sym_name unused, even. There may be
more instances of this in the patch. /me off to bed. :-)

--
Pedro Alves