summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorstu <stwo@users.sourceforge.net>2017-06-05 18:33:57 (GMT)
committerstu <stwo@users.sourceforge.net>2017-06-05 18:33:57 (GMT)
commita323b71adcc1795f6d3e38d0a3a51ff10b8d76b9 (patch)
tree16d4f7c60c955d540aaee31eb84bff501bcb5f70 /generic/tclIO.c
parent51b616c6fb451a91e7ac680f3998eef84c352658 (diff)
downloadtcl-stwo_dev86.zip
tcl-stwo_dev86.tar.gz
tcl-stwo_dev86.tar.bz2
Change the return type of Tcl_RegisterChannel from void to Tcl_Channel and have Tcl_RegisterChannel return the channel. his is a convenience to the programmer.stwo_dev86
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 1460392..a1f9e30 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -1138,7 +1138,7 @@ Tcl_IsStandardChannel(
* channel refCount.
*
* Results:
- * None.
+ * The channel.
*
* Side effects:
* May increment the reference count of a channel.
@@ -1146,7 +1146,7 @@ Tcl_IsStandardChannel(
*----------------------------------------------------------------------
*/
-void
+Tcl_Channel
Tcl_RegisterChannel(
Tcl_Interp *interp, /* Interpreter in which to add the channel. */
Tcl_Channel chan) /* The channel to add to this interpreter
@@ -1175,7 +1175,7 @@ Tcl_RegisterChannel(
hPtr = Tcl_CreateHashEntry(hTblPtr, statePtr->channelName, &isNew);
if (!isNew) {
if (chan == Tcl_GetHashValue(hPtr)) {
- return;
+ return chan;
}
Tcl_Panic("Tcl_RegisterChannel: duplicate channel names");
@@ -1183,6 +1183,8 @@ Tcl_RegisterChannel(
Tcl_SetHashValue(hPtr, chanPtr);
}
statePtr->refCount++;
+
+ return chan;
}
/*