From 64efa9f157a95e8ab0f7510e18b9cc2121420c16 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 2 Mar 2013 20:06:09 +0000 Subject: Member TtyState.savedState set in TtyInit() but never subsequently used. This can go away... --- unix/tclUnixChan.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index d61d546..4c1cb05 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -80,8 +80,6 @@ typedef struct FileState { typedef struct TtyState { FileState fs; /* Per-instance state of the file descriptor. * Must be the first field. */ - struct termios savedState; /* Initial state of device. Used to reset - * state when device closed. */ } TtyState; /* @@ -1307,32 +1305,25 @@ TtyInit( int initialize) { TtyState *ttyPtr = ckalloc(sizeof(TtyState)); - int stateUpdated = 0; - tcgetattr(fd, &ttyPtr->savedState); if (initialize) { - struct termios iostate = ttyPtr->savedState; + struct termios iostate; + tcgetattr(fd, &iostate); if (iostate.c_iflag != IGNBRK || iostate.c_oflag != 0 || iostate.c_lflag != 0 || iostate.c_cflag & CREAD || iostate.c_cc[VMIN] != 1 - || iostate.c_cc[VTIME] != 0) { - stateUpdated = 1; - } - iostate.c_iflag = IGNBRK; - iostate.c_oflag = 0; - iostate.c_lflag = 0; - SET_BITS(iostate.c_cflag, CREAD); - iostate.c_cc[VMIN] = 1; - iostate.c_cc[VTIME] = 0; - - /* - * Only update if we're changing anything to avoid possible blocking. - */ + || iostate.c_cc[VTIME] != 0) + { + iostate.c_iflag = IGNBRK; + iostate.c_oflag = 0; + iostate.c_lflag = 0; + iostate.c_cflag |= CREAD; + iostate.c_cc[VMIN] = 1; + iostate.c_cc[VTIME] = 0; - if (stateUpdated) { tcsetattr(fd, TCSADRAIN, &iostate); } } -- cgit v0.12