Re: [RFA] "constify" parse_exp_1

Pedro Alves
2013-03-12T10:18:56Z

On 03/11/2013 10:09 PM, Keith Seitz wrote:

> 2013-03-07 Keith Seitz <keiths@redhat.com>
>
> * ada-lang.c (ada_read_renaming_var_value): Pass const
> pointer to expression string to parse_exp_1.
> (craete_excep_cond_exprs): Likewise.

s/craete/create

> * ax-gdb.c (agent_eval_command_one): Likewise.
> (maint_agent_printf_command): Likewise.
> Constify much of the string handling/parsing.
> * breakpoint.c (set_breakpoint_condition): Pass const
> pointer to expression string to parse_exp_1.
> (update_watchpoint): Likewise.
> (parse_cmd_to_aexpr): Constify string handling.
> Pass const pointer to parse_exp_1.
> (init_breakpoint_sal): Pass const pointer to parse_exp_1.
> (find_condition_and_thread): Likewise.
> Make TOK const.
> (watch_command_1): Make ARG const.

(Minor note: pedantically, uppercase is used when talking
about the value of the variable, rather than the variable
itself.)

> --- cli/cli-utils.h 12 Feb 2013 19:03:55 -0000 1.18
> +++ cli/cli-utils.h 11 Mar 2013 21:57:24 -0000
> @@ -101,7 +101,9 @@ extern const char *skip_spaces_const (co
> /* Skip leading non-whitespace characters in INP, returning an updated
> pointer. If INP is NULL, return NULL. */
>
> -extern char *skip_to_space (char *inp);
> +#define skip_to_space(INP) ((char *) skip_to_space_const ((INP)))

Double (())s not necessary:

#define skip_to_space(INP) ((char *) skip_to_space_const (INP))

Can you please add:

+ /* A const-correct version of the above. */

extern const char *skip_to_space_const (const char *inp);

Just like skip_spaces_const has too.

Otherwise this all looks good to me.

--
Pedro Alves