diff options
author | limeboy <that.lemon+tcl@gmai.com> | 2017-01-01 22:19:26 (GMT) |
---|---|---|
committer | limeboy <that.lemon+tcl@gmai.com> | 2017-01-01 22:19:26 (GMT) |
commit | 7628e8f3871e65f729e55364626f5684b172bddc (patch) | |
tree | 5fbf574fb459dba03c5885ad66687011693278ea | |
parent | 05119eaad1bb3205fa0a31abacf99d6ae33f20e1 (diff) | |
download | tcl-7628e8f3871e65f729e55364626f5684b172bddc.zip tcl-7628e8f3871e65f729e55364626f5684b172bddc.tar.gz tcl-7628e8f3871e65f729e55364626f5684b172bddc.tar.bz2 |
Make the code slightly more pleasing to the eyes.
-rw-r--r-- | generic/tclIOCmd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 682eaf4..1bd3fe7 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1618,8 +1618,16 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - if (reusea!=0) flags |= TCL_TCPSERVER_REUSEADDR; - if (reusep==1) flags |= TCL_TCPSERVER_REUSEPORT; + // Set the options to their default value if the user didn't override their + // value. + if (reusep == -1) reusep = 0; + if (reusea == -1) reusea = 1; + + // Build the bitset with the flags values. + if (reusea) + flags |= TCL_TCPSERVER_REUSEADDR; + if (reusep) + flags |= TCL_TCPSERVER_REUSEPORT; // All the arguments should have been parsed by now, 'a' points to the last // one, the port number. |