summaryrefslogtreecommitdiffstats
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)
commita2c66d61f0e05792f61868e5e1228672b38d555f (patch)
tree5fbf574fb459dba03c5885ad66687011693278ea
parentaba0a7a6cd1bcf03d86534287dfe32ab48b646fe (diff)
downloadtcl-a2c66d61f0e05792f61868e5e1228672b38d555f.zip
tcl-a2c66d61f0e05792f61868e5e1228672b38d555f.tar.gz
tcl-a2c66d61f0e05792f61868e5e1228672b38d555f.tar.bz2
Make the code slightly more pleasing to the eyes.
-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.