summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-02-11 15:56:27 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-02-11 15:56:27 (GMT)
commit4d05a07f5bfa8d6ef796bfb9edf79e49d6fda7e3 (patch)
tree51d216dbc9402efae058ce465b5cbf3f0ca8d124 /generic/tclIO.c
parent884bdbb9401fca546ba8dd20b4d713fd8897840d (diff)
downloadtcl-4d05a07f5bfa8d6ef796bfb9edf79e49d6fda7e3.zip
tcl-4d05a07f5bfa8d6ef796bfb9edf79e49d6fda7e3.tar.gz
tcl-4d05a07f5bfa8d6ef796bfb9edf79e49d6fda7e3.tar.bz2
Even clearer failure messages.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 0ba864a..aabae0b 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -1548,23 +1548,24 @@ Tcl_CreateChannel(
*/
assert(sizeof(Tcl_ChannelTypeVersion) == sizeof(Tcl_DriverBlockModeProc *));
- if (NULL == typePtr->closeProc)
- Tcl_Panic("Required closeProc is unset.");
-
- if ((TCL_READABLE & mask) && (NULL == typePtr->inputProc))
- Tcl_Panic("Required inputProc is unset.");
-
- if ((TCL_WRITABLE & mask) && (NULL == typePtr->outputProc))
- Tcl_Panic("Required outputProc is unset.");
-
- if (NULL == typePtr->watchProc)
- Tcl_Panic("Required watchProc is unset.");
-
- if (NULL == typePtr->getHandleProc)
- Tcl_Panic("Required getHandleProc is unset.");
-
+ assert(typePtr->typeName != NULL);
+ if (NULL == typePtr->closeProc) {
+ Tcl_Panic("channel type %s must define closeProc", typePtr->typeName);
+ }
+ if ((TCL_READABLE & mask) && (NULL == typePtr->inputProc)) {
+ Tcl_Panic("channel type %s must define inputProc when used for reader channel", typePtr->typeName);
+ }
+ if ((TCL_WRITABLE & mask) && (NULL == typePtr->outputProc)) {
+ Tcl_Panic("channel type %s must define outputProc when used for writer channel", typePtr->typeName);
+ }
+ if (NULL == typePtr->watchProc) {
+ Tcl_Panic("channel type %s must define watchProc", typePtr->typeName);
+ }
+ if (NULL == typePtr->getHandleProc) {
+ Tcl_Panic("channel type %s must define getHandleProc", typePtr->typeName);
+ }
if ((NULL!=typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) {
- Tcl_Panic("Must define seekProc if defining wideSeekProc");
+ Tcl_Panic("channel type %s must define seekProc if defining wideSeekProc", typePtr->typeName);
}
/*