gdb: Small code restructure for list_command.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 16 Nov 2015 09:30:35 +0000 (09:30 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 11 Dec 2015 23:04:25 +0000 (23:04 +0000)
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.

gdb/ChangeLog
gdb/cli/cli-cmds.c

index 7b155d3d8a641128b58ffebc1276fc74186c7cff..17db0c3c846a615dd5943aefe2f4af26caa99735 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-11  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * cli/cli-cmds.c (list_command): Move all handling of +/-
+       arguments into a single if block.
+
 2015-12-11  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * cli/cli-cmds.c (list_command): Use NULL instead of 0 when
index 841fc555671970ab903bf0415d6d03acda1dfe73..872c844d8783e0693295d7039d713b8466084dca 100644 (file)
@@ -930,27 +930,21 @@ list_command (char *arg, int from_tty)
 
          print_source_lines (cursal.symtab, first,
                              first + get_lines_to_list (), 0);
-         return;
        }
-    }
 
-  /* "l" or "l +" lists next ten lines.  */
+      /* "l" or "l +" lists next ten lines.  */
+      else if (arg == NULL || strcmp (arg, "+") == 0)
+       print_source_lines (cursal.symtab, cursal.line,
+                           cursal.line + get_lines_to_list (), 0);
 
-  if (arg == NULL || strcmp (arg, "+") == 0)
-    {
-      print_source_lines (cursal.symtab, cursal.line,
-                         cursal.line + get_lines_to_list (), 0);
-      return;
-    }
+      /* "l -" lists previous ten lines, the ones before the ten just
+        listed.  */
+      else if (strcmp (arg, "-") == 0)
+       print_source_lines (cursal.symtab,
+                           max (get_first_line_listed ()
+                                - get_lines_to_list (), 1),
+                           get_first_line_listed (), 0);
 
-  /* "l -" lists previous ten lines, the ones before the ten just
-     listed.  */
-  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;
     }
 
This page took 0.029842 seconds and 4 git commands to generate.