From c5cbfc795cc50cd0ec76faa503f77344fb69a94a Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 15 Nov 2007 16:21:02 +0000 Subject: Must pass non-NULL interp to Tcl_SetEnsemble* functions. --- ChangeLog | 3 +++ doc/Ensemble.3 | 6 ++++-- generic/tclNamesp.c | 28 +++++++++++----------------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62aabfb..ee38587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-11-15 Donal K. Fellows + * generic/tclNamesp.c (NamespaceEnsembleCmd): Must pass a non-NULL + interp to Tcl_SetEnsemble* functions. + * doc/re_syntax.n: Try to make this easier to read. It's still a very difficult manual page! diff --git a/doc/Ensemble.3 b/doc/Ensemble.3 index 5525226..3ce9099 100644 --- a/doc/Ensemble.3 +++ b/doc/Ensemble.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: Ensemble.3,v 1.3 2006/10/18 18:46:59 dgp Exp $ +'\" RCS: @(#) $Id: Ensemble.3,v 1.4 2007/11/15 16:21:04 dkf Exp $ '\" '\" This documents the C API introduced in TIP#235 '\" @@ -56,7 +56,9 @@ int .AS Tcl_Namespace **namespacePtrPtr in/out .AP Tcl_Interp *interp in/out The interpreter in which the ensemble is to be created or found. Also -where error result messages are written. +where error result messages are written. The functions whose names +start with \fBTcl_GetEnsemble\fR may have a NULL for the \fIinterp\fR, +but all other functions must not. .AP "const char" *name in The name of the ensemble command to be created. .AP Tcl_Namespace *namespacePtr in diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index df5fb56..5c6582d 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.153 2007/11/14 23:05:03 dkf Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.154 2007/11/15 16:21:04 dkf Exp $ */ #include "tclInt.h" @@ -5200,10 +5200,10 @@ NamespaceEnsembleCmd( flags = (permitPrefix ? flags|TCL_ENSEMBLE_PREFIX : flags&~TCL_ENSEMBLE_PREFIX); - Tcl_SetEnsembleSubcommandList(NULL, token, subcmdObj); - Tcl_SetEnsembleMappingDict(NULL, token, mapObj); - Tcl_SetEnsembleUnknownHandler(NULL, token, unknownObj); - Tcl_SetEnsembleFlags(NULL, token, flags); + Tcl_SetEnsembleSubcommandList(interp, token, subcmdObj); + Tcl_SetEnsembleMappingDict(interp, token, mapObj); + Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); + Tcl_SetEnsembleFlags(interp, token, flags); return TCL_OK; } @@ -5318,13 +5318,12 @@ Tcl_SetEnsembleSubcommandList( Tcl_Obj *oldList; if (cmdPtr->objProc != NsEnsembleImplementationCmd) { - if (interp != NULL) { - Tcl_AppendResult(interp, "command is not an ensemble", NULL); - } + Tcl_AppendResult(interp, "command is not an ensemble", NULL); return TCL_ERROR; } if (subcmdList != NULL) { int length; + if (TclListObjLength(interp, subcmdList, &length) != TCL_OK) { return TCL_ERROR; } @@ -5395,13 +5394,12 @@ Tcl_SetEnsembleMappingDict( Tcl_Obj *oldDict; if (cmdPtr->objProc != NsEnsembleImplementationCmd) { - if (interp != NULL) { - Tcl_AppendResult(interp, "command is not an ensemble", NULL); - } + Tcl_AppendResult(interp, "command is not an ensemble", NULL); return TCL_ERROR; } if (mapDict != NULL) { int size; + if (Tcl_DictObjSize(interp, mapDict, &size) != TCL_OK) { return TCL_ERROR; } @@ -5472,9 +5470,7 @@ Tcl_SetEnsembleUnknownHandler( Tcl_Obj *oldList; if (cmdPtr->objProc != NsEnsembleImplementationCmd) { - if (interp != NULL) { - Tcl_AppendResult(interp, "command is not an ensemble", NULL); - } + Tcl_AppendResult(interp, "command is not an ensemble", NULL); return TCL_ERROR; } if (unknownList != NULL) { @@ -5537,9 +5533,7 @@ Tcl_SetEnsembleFlags( EnsembleConfig *ensemblePtr; if (cmdPtr->objProc != NsEnsembleImplementationCmd) { - if (interp != NULL) { - Tcl_AppendResult(interp, "command is not an ensemble", NULL); - } + Tcl_AppendResult(interp, "command is not an ensemble", NULL); return TCL_ERROR; } -- cgit v0.12