Mercurial > hg > xemacs-beta
diff src/console-stream.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 966663fcf606 |
children | 558f606b08ae |
line wrap: on
line diff
--- a/src/console-stream.c Mon Aug 13 10:27:41 2007 +0200 +++ b/src/console-stream.c Mon Aug 13 10:28:48 2007 +0200 @@ -34,6 +34,7 @@ #include "frame.h" #include "redisplay.h" #include "sysdep.h" +#include "sysfile.h" #include "window.h" DEFINE_CONSOLE_TYPE (stream); @@ -47,14 +48,10 @@ static void allocate_stream_console_struct (struct console *con) { - if (!con->console_data) - { - con->console_data = xnew_and_zero (struct stream_console); - } + if (!CONSOLE_STREAM_DATA (con)) + CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console); else - { - memset(con->console_data, 0, sizeof (struct stream_console)); - } + xzero (*CONSOLE_STREAM_DATA (con)); } static void @@ -67,7 +64,7 @@ if (NILP (tty) || internal_equal (tty, Vstdio_str, 0)) { - infd = stdin; + infd = stdin; outfd = stdout; errfd = stderr; } @@ -81,7 +78,7 @@ } allocate_stream_console_struct (con); - CONSOLE_STREAM_DATA (con)->infd = infd; + CONSOLE_STREAM_DATA (con)->infd = infd; CONSOLE_STREAM_DATA (con)->outfd = outfd; CONSOLE_STREAM_DATA (con)->errfd = errfd; } @@ -91,7 +88,7 @@ { struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); - DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd); + DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd); DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->outfd); init_baud_rate (d); init_one_device (d); @@ -106,11 +103,10 @@ static void free_stream_console_struct (struct console *con) { - struct stream_console *tcon = (struct stream_console *) con->console_data; - if (tcon) + if (CONSOLE_STREAM_DATA (con)) { - xfree (tcon); - con->console_data = NULL; + xfree (CONSOLE_STREAM_DATA (con)); + CONSOLE_STREAM_DATA (con) = NULL; } } @@ -134,10 +130,7 @@ stream_semi_canonicalize_console_connection (Lisp_Object connection, Error_behavior errb) { - if (NILP (connection)) - return Vstdio_str; - - return connection; + return NILP (connection) ? Vstdio_str : connection; } Lisp_Object @@ -176,8 +169,8 @@ static void stream_init_frame_1 (struct frame *f, Lisp_Object props) { +#if 0 struct device *d = XDEVICE (FRAME_DEVICE (f)); -#if 0 if (!NILP (DEVICE_FRAME_LIST (d))) error ("Only one frame allowed on stream devices"); #endif @@ -355,10 +348,11 @@ Vterminal_frame = Fmake_frame (Qnil, Vterminal_device); minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window; } - else { - /* Re-initialize the FILE fields of the console. */ - stream_init_console (XCONSOLE (Vterminal_console), Qnil); - if (noninteractive) - event_stream_select_console (XCONSOLE (Vterminal_console)); - } + else + { + /* Re-initialize the FILE fields of the console. */ + stream_init_console (XCONSOLE (Vterminal_console), Qnil); + if (noninteractive) + event_stream_select_console (XCONSOLE (Vterminal_console)); + } }