summaryrefslogtreecommitdiffstats
path: root/generic/tclIOCmd.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-04-11 14:14:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-04-11 14:14:05 (GMT)
commitbc2940927e48190e91f3dd7a90274411eecbccc9 (patch)
tree72af08cb803c98359747f491a103cb4282b777d3 /generic/tclIOCmd.c
parent5c21b9c7c7e7f6442ed8b09ce672495f60df5e87 (diff)
parent26f98a5e562b865e82adcc6b7de05df4b0fa07de (diff)
downloadtcl-bc2940927e48190e91f3dd7a90274411eecbccc9.zip
tcl-bc2940927e48190e91f3dd7a90274411eecbccc9.tar.gz
tcl-bc2940927e48190e91f3dd7a90274411eecbccc9.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r--generic/tclIOCmd.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 1bd3fe7..e52200d 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -1618,19 +1618,34 @@ Tcl_SocketObjCmd(
return TCL_ERROR;
}
- // 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;
+ /*
+ * Set the options to their default value if the user didn't override
+ * their value.
+ */
- // Build the bitset with the flags values.
- if (reusea)
+ 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)
+ }
+ if (reusep) {
flags |= TCL_TCPSERVER_REUSEPORT;
+ }
+
+ /*
+ * All the arguments should have been parsed by now, 'a' points to the
+ * last one, the port number.
+ */
- // All the arguments should have been parsed by now, 'a' points to the last
- // one, the port number.
if (a != objc-1) {
goto wrongNumArgs;
}
@@ -1638,15 +1653,14 @@ Tcl_SocketObjCmd(
port = TclGetString(objv[a]);
if (server) {
- AcceptCallback *acceptCallbackPtr =
- ckalloc(sizeof(AcceptCallback));
+ AcceptCallback *acceptCallbackPtr = ckalloc(sizeof(AcceptCallback));
Tcl_IncrRefCount(script);
acceptCallbackPtr->script = script;
acceptCallbackPtr->interp = interp;
- chan = Tcl_OpenTcpServerEx(interp, port, host, flags, AcceptCallbackProc,
- acceptCallbackPtr);
+ chan = Tcl_OpenTcpServerEx(interp, port, host, flags,
+ AcceptCallbackProc, acceptCallbackPtr);
if (chan == NULL) {
Tcl_DecrRefCount(script);
ckfree(acceptCallbackPtr);