summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorlimeboy <that.lemon+tcl@gmai.com>2017-01-01 22:19:26 (GMT)
committerlimeboy <that.lemon+tcl@gmai.com>2017-01-01 22:19:26 (GMT)
commit7628e8f3871e65f729e55364626f5684b172bddc (patch)
tree5fbf574fb459dba03c5885ad66687011693278ea /generic
parent05119eaad1bb3205fa0a31abacf99d6ae33f20e1 (diff)
downloadtcl-7628e8f3871e65f729e55364626f5684b172bddc.zip
tcl-7628e8f3871e65f729e55364626f5684b172bddc.tar.gz
tcl-7628e8f3871e65f729e55364626f5684b172bddc.tar.bz2
Make the code slightly more pleasing to the eyes.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOCmd.c12
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.