This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] "constify" parse_exp_1
- From: Pedro Alves <palves at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Fri, 08 Mar 2013 00:22:23 +0000
- Subject: Re: [RFA] "constify" parse_exp_1
- References: <51392C56.7040302@redhat.com>
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