This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [RFA 37/67] Constify some commands in record.c
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Tom Tromey <tom at tromey dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 21 Sep 2017 07:02:39 +0000
- Subject: RE: [RFA 37/67] Constify some commands in record.c
- Authentication-results: sourceware.org; auth=none
- Dlp-product: dlpe-windows
- Dlp-reaction: no-action
- Dlp-version: 11.0.0.116
- References: <20170921051023.19023-1-tom@tromey.com> <20170921051023.19023-38-tom@tromey.com>
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:10 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 37/67] Constify some commands in record.c
Hello Tom,
> ChangeLog
> 2017-09-20 Tom Tromey <tom@tromey.com>
>
> * record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
> (cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
> (get_context_size, no_chunk, get_insn_history_modifiers)
> (cmd_record_insn_history, get_call_history_modifiers)
> (cmd_record_call_history): Constify.
> ---
> gdb/ChangeLog | 8 ++++++++
> gdb/record.c | 36 ++++++++++++++++++++----------------
> 2 files changed, 28 insertions(+), 16 deletions(-)
Looks good to me.
> @@ -354,7 +354,8 @@ info_record_command (char *args, int from_tty)
> static void
> cmd_record_save (char *args, int from_tty)
> {
> - char *recfilename, recfilename_buffer[40];
> + const char *recfilename;
> + char recfilename_buffer[40];
>
> require_record_target ();
This isn't really related to adding a const add_cmd () version.
> @@ -456,13 +458,15 @@ get_context_size (char **arg)
> if (!isdigit (*pos))
> error (_("Expected positive number, got: %s."), pos);
>
> - return strtol (pos, arg, 10);
> + long result = strtol (pos, &end, 10);
> + *arg = end;
> + return result;
> }
The rest of the declarations are still at the beginning.
Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928