diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-11 10:04:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-11 10:04:00 (GMT) |
commit | 4e13febe7fbcefed6fbe8e65cc0ac5cb846112dd (patch) | |
tree | ef20ef3f00b8d97a81694f9eb9be77c83200119e /generic/tclIOCmd.c | |
parent | af14f754dc252005155415d1905b73ef93d0c1ee (diff) | |
parent | 821193ec1ef8bacf91eb146890e3f81b0f49feeb (diff) | |
download | tcl-4e13febe7fbcefed6fbe8e65cc0ac5cb846112dd.zip tcl-4e13febe7fbcefed6fbe8e65cc0ac5cb846112dd.tar.gz tcl-4e13febe7fbcefed6fbe8e65cc0ac5cb846112dd.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index b6bf2a1..a168c33 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1591,19 +1591,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; } @@ -1611,15 +1626,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); |