This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 13/13] constify target fields
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 24 Jul 2014 03:08:01 +0100
- Subject: Re: [PATCH 13/13] constify target fields
- Authentication-results: sourceware.org; auth=none
- References: <1406055319-26380-1-git-send-email-tromey at redhat dot com> <1406055319-26380-14-git-send-email-tromey at redhat dot com>
Looks good.
Thanks,
Pedro Alves
On 07/22/2014 07:55 PM, Tom Tromey wrote:
> This constifies the target_ops fields to_shortname, to_longname, and
> to_doc.
>
> 2014-07-22 Tom Tromey <tromey@redhat.com>
>
> * monitor.c (compile_pattern): Update.
> * target.h (struct target_ops) <to_shortname, to_longname,
> to_doc>: Now const.
> ---
> gdb/ChangeLog | 6 ++++++
> gdb/monitor.c | 2 +-
> gdb/target.h | 6 +++---
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/monitor.c b/gdb/monitor.c
> index 788bca0..6767197 100644
> --- a/gdb/monitor.c
> +++ b/gdb/monitor.c
> @@ -715,7 +715,7 @@ compile_pattern (char *pattern, struct re_pattern_buffer *compiled_pattern,
> void
> monitor_open (const char *args, struct monitor_ops *mon_ops, int from_tty)
> {
> - char *name;
> + const char *name;
> char **p;
> struct inferior *inf;
>
> diff --git a/gdb/target.h b/gdb/target.h
> index 35a7d7d..9df96af 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -384,9 +384,9 @@ typedef void async_callback_ftype (enum inferior_event_type event_type,
> struct target_ops
> {
> struct target_ops *beneath; /* To the target under this one. */
> - char *to_shortname; /* Name this target type */
> - char *to_longname; /* Name for printing */
> - char *to_doc; /* Documentation. Does not include trailing
> + const char *to_shortname; /* Name this target type */
> + const char *to_longname; /* Name for printing */
> + const char *to_doc; /* Documentation. Does not include trailing
> newline, and starts with a one-line descrip-
> tion (probably similar to to_longname). */
> /* Per-target scratch pad. */
>