This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 02/30] Inline command_loop in read_command_line
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 18 Mar 2016 19:18:06 +0000
- Subject: [PATCH 02/30] Inline command_loop in read_command_line
- Authentication-results: sourceware.org; auth=none
- References: <1458328714-4938-1-git-send-email-palves at redhat dot com>
read_command_line is the only caller, and here we can assume we're
reading a regular file, not stdin.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* top.c (read_command_file): Inline command_loop here.
(command_loop): Delete.
---
gdb/top.c | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/gdb/top.c b/gdb/top.c
index 90a3f48..41ff6b2 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -283,7 +283,21 @@ read_command_file (FILE *stream)
cleanups = make_cleanup (do_restore_instream_cleanup, instream);
instream = stream;
- command_loop ();
+
+ /* Read commands from `instream' and execute them until end of file
+ or error reading instream. */
+
+ while (instream != NULL && !feof (instream))
+ {
+ char *command;
+
+ /* Get a command-line. This calls the readline package. */
+ command = command_line_input (NULL, 0, NULL);
+ if (command == NULL)
+ break;
+ command_handler (command);
+ }
+
do_cleanups (cleanups);
}
@@ -528,25 +542,6 @@ execute_command_to_string (char *p, int from_tty)
return retval;
}
-/* Read commands from `instream' and execute them
- until end of file or error reading instream. */
-
-void
-command_loop (void)
-{
- while (instream && !feof (instream))
- {
- char *command;
-
- /* Get a command-line. This calls the readline package. */
- command = command_line_input (instream == stdin ?
- get_prompt () : (char *) NULL,
- instream == stdin, "prompt");
- if (command == NULL)
- return;
- command_handler (command);
- }
-}
/* When nonzero, cause dont_repeat to do nothing. This should only be
set via prevent_dont_repeat. */
--
2.5.0