diff options
author | Pedro Alves <palves@redhat.com> | 2016-04-12 16:49:29 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-04-12 16:50:41 +0100 |
commit | faa4ebe148cfe83f06d881cfc80d95575d3bf746 (patch) | |
tree | 170e75dad6d847eb8ab423f71efdfabf0c0826cc /gdb/top.c | |
parent | 3212b858458dc3f2ae73e32fa066dabd56919a13 (diff) | |
download | gdb-faa4ebe148cfe83f06d881cfc80d95575d3bf746.zip gdb-faa4ebe148cfe83f06d881cfc80d95575d3bf746.tar.gz gdb-faa4ebe148cfe83f06d881cfc80d95575d3bf746.tar.bz2 |
Inline command_loop in read_command_line
read_command_line is the only caller, and here we can assume we're
reading a regular file, not stdin.
gdb/ChangeLog:
2016-04-12 Pedro Alves <palves@redhat.com>
* top.c (read_command_file): Inline command_loop here.
(command_loop): Delete.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -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. */ |