This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/7] gdb: Small code restructure for list_command.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Thu, 26 Nov 2015 12:37:31 +0000
- Subject: Re: [PATCH 3/7] gdb: Small code restructure for list_command.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1448411121 dot git dot andrew dot burgess at embecosm dot com> <1c3dd6d5b28b0bb19a0d0b94e83c9182306722ab dot 1448411121 dot git dot andrew dot burgess at embecosm dot com>
On 11/25/2015 12:34 AM, Andrew Burgess wrote:
> Move handling of special +/- arguments to the list_command function
> inside a single if block, this helps group all related functionality
> together. There should be no user visible changes after this commit.
>
> gdb/ChangeLog:
>
> * cli/cli-cmds.c (list_command): Move all handling of +/-
> arguments into a single if block.
OK.
> + if (arg == NULL || strcmp (arg, "+") == 0)
> + {
> + print_source_lines (cursal.symtab, cursal.line,
> + cursal.line + get_lines_to_list (), 0);
> + return;
> + }
>
...
> + if (strcmp (arg, "-") == 0)
> + {
> + print_source_lines (cursal.symtab,
> + max (get_first_line_listed ()
> + - get_lines_to_list (), 1),
> + get_first_line_listed (), 0);
> + return;
> + }
> }
(Seems to me you could hoist the returns out now.)
Thanks,
Pedro Alves