This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 4/8] Replace hardwired error handlers in tui_initialize_io


tui_initialize_io contains a pair of hardwired fprintf/exit error
handlers.  I was unable to find any documentation as to why they're
hardwired (the code appeared in a monolithic block back in 2001:
https://sourceware.org/ml/gdb-patches/2001-07/msg00490.html) and I
was also unable to come up with a situation where error would not
be suitable, so I have replaced both handlers with calls to error.

gdb/
2014-08-05  Gary Benson  <gbenson@redhat.com>

	* tui/tui-io.c (tui_initialize_io): Replace two fprintf/exit
	pairs with calls to error.  Wrap the message with _().
---
 gdb/ChangeLog    |    5 +++++
 gdb/tui/tui-io.c |   12 ++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 75eb4b8..11b2366 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -617,16 +617,12 @@ tui_initialize_io (void)
      readline output in a pipe, read that pipe and output the content
      in the curses command window.  */
   if (gdb_pipe_cloexec (tui_readline_pipe) != 0)
-    {
-      fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
-      exit (1);
-    }
+    error (_("Cannot create pipe for readline"));
+
   tui_rl_outstream = fdopen (tui_readline_pipe[1], "w");
   if (tui_rl_outstream == 0)
-    {
-      fprintf_unfiltered (gdb_stderr, "Cannot redirect readline output");
-      exit (1);
-    }
+    error (_("Cannot redirect readline output"));
+
   setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0);
 
 #ifdef O_NONBLOCK
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]