summaryrefslogtreecommitdiffstats
path: root/generic/tclOOInfo.c
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2012-12-17 14:40:17 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2012-12-17 14:40:17 (GMT)
commita2ac971bd9c8493d9460b4117b6918ba3061ca6a (patch)
tree7cf5d886f5ef425a0674810b249e24add7edc174 /generic/tclOOInfo.c
parentbb77f044ab873e334061d2ceabd50b8abfb06301 (diff)
parented66fb429266da4a6f03e9634111829bd0d57cfa (diff)
downloadtcl-a2ac971bd9c8493d9460b4117b6918ba3061ca6a.zip
tcl-a2ac971bd9c8493d9460b4117b6918ba3061ca6a.tar.gz
tcl-a2ac971bd9c8493d9460b4117b6918ba3061ca6a.tar.bz2
Simpler code to do installation of [info class] and [info object].
We know this is a safe thing to do as we know this is inside Tcl_CreateInterp() and so no confounding code could have been run.
Diffstat (limited to 'generic/tclOOInfo.c')
-rw-r--r--generic/tclOOInfo.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index e09ee4e..5be9b01 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -100,6 +100,7 @@ TclOOInitInfo(
Tcl_Interp *interp)
{
Tcl_Command infoCmd;
+ Tcl_Obj *mapDict;
/*
* Build the ensembles used to implement [info object] and [info class].
@@ -113,25 +114,12 @@ TclOOInitInfo(
*/
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
- if (infoCmd != NULL && Tcl_IsEnsemble(infoCmd)) {
- Tcl_Obj *mapDict, *objectObj, *classObj;
-
- Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
- if (mapDict != NULL) {
- objectObj = Tcl_NewStringObj("object", -1);
- classObj = Tcl_NewStringObj("class", -1);
-
- Tcl_IncrRefCount(objectObj);
- Tcl_IncrRefCount(classObj);
- Tcl_DictObjPut(NULL, mapDict, objectObj,
- Tcl_NewStringObj("::oo::InfoObject", -1));
- Tcl_DictObjPut(NULL, mapDict, classObj,
- Tcl_NewStringObj("::oo::InfoClass", -1));
- Tcl_DecrRefCount(objectObj);
- Tcl_DecrRefCount(classObj);
- Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
- }
- }
+ Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
+ Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
+ Tcl_NewStringObj("::oo::InfoObject", -1));
+ Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
+ Tcl_NewStringObj("::oo::InfoClass", -1));
+ Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
}
/*