summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe>2013-03-02 20:06:09 (GMT)
committerjoe <joe>2013-03-02 20:06:09 (GMT)
commit64efa9f157a95e8ab0f7510e18b9cc2121420c16 (patch)
tree2307591f41b0b888a2d40e945554d5e5d62365a9
parent5b8a43fb71be3dd89019f395449a62a6edb823bd (diff)
downloadtcl-64efa9f157a95e8ab0f7510e18b9cc2121420c16.zip
tcl-64efa9f157a95e8ab0f7510e18b9cc2121420c16.tar.gz
tcl-64efa9f157a95e8ab0f7510e18b9cc2121420c16.tar.bz2
Member TtyState.savedState set in TtyInit() but never subsequently used.
This can go away...
-rw-r--r--unix/tclUnixChan.c29
1 files 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);
}
}