summaryrefslogtreecommitdiffstats
path: root/src/bltInt.C
diff options
context:
space:
mode:
authorjoye <joye>2014-01-31 20:33:50 (GMT)
committerjoye <joye>2014-01-31 20:33:50 (GMT)
commitc37f39fa00ad971b46a19f850938d39a957b9c46 (patch)
tree3edfb0ad47b9585a605d5c897b45b5997ff02c54 /src/bltInt.C
parentf0c9d91ca43b3fa4757e4ca769502696abd201db (diff)
downloadblt-c37f39fa00ad971b46a19f850938d39a957b9c46.zip
blt-c37f39fa00ad971b46a19f850938d39a957b9c46.tar.gz
blt-c37f39fa00ad971b46a19f850938d39a957b9c46.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltInt.C')
-rw-r--r--src/bltInt.C53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/bltInt.C b/src/bltInt.C
index 082d17d..2fdeaa9 100644
--- a/src/bltInt.C
+++ b/src/bltInt.C
@@ -92,36 +92,31 @@ int Tkblt_SafeInit(Tcl_Interp *interp)
int Blt_InitCmd(Tcl_Interp *interp, const char *nsName,
Blt_InitCmdSpec *specPtr)
{
- const char *cmdPath;
- Tcl_DString dString;
- Tcl_Command cmdToken;
- Tcl_Namespace *nsPtr;
-
- Tcl_DStringInit(&dString);
- if (nsName != NULL) {
- Tcl_DStringAppend(&dString, nsName, -1);
- }
- Tcl_DStringAppend(&dString, "::", -1);
- Tcl_DStringAppend(&dString, specPtr->name, -1);
-
- cmdPath = Tcl_DStringValue(&dString);
- cmdToken = Tcl_FindCommand(interp, cmdPath, (Tcl_Namespace *)NULL, 0);
- if (cmdToken != NULL) {
- Tcl_DStringFree(&dString);
- return TCL_OK; /* Assume command was already initialized */
- }
- cmdToken = Tcl_CreateObjCommand(interp, cmdPath, specPtr->cmdProc,
- specPtr->clientData, specPtr->cmdDeleteProc);
+ Tcl_DString dString;
+ Tcl_DStringInit(&dString);
+ if (nsName)
+ Tcl_DStringAppend(&dString, nsName, -1);
+ Tcl_DStringAppend(&dString, "::", -1);
+ Tcl_DStringAppend(&dString, specPtr->name, -1);
+
+ const char* cmdPath = Tcl_DStringValue(&dString);
+ Tcl_Command cmdToken = Tcl_FindCommand(interp, cmdPath, NULL, 0);
+ if (cmdToken) {
Tcl_DStringFree(&dString);
- nsPtr = Tcl_FindNamespace(interp, nsName, (Tcl_Namespace *)NULL,
- TCL_LEAVE_ERR_MSG);
- if (nsPtr == NULL) {
- return TCL_ERROR;
- }
- if (Tcl_Export(interp, nsPtr, specPtr->name, FALSE) != TCL_OK) {
- return TCL_ERROR;
- }
- return TCL_OK;
+ return TCL_OK; /* Assume command was already initialized */
+ }
+ cmdToken = Tcl_CreateObjCommand(interp, cmdPath, specPtr->cmdProc,
+ specPtr->clientData, specPtr->cmdDeleteProc);
+ Tcl_DStringFree(&dString);
+ Tcl_Namespace* nsPtr = Tcl_FindNamespace(interp, nsName, NULL,
+ TCL_LEAVE_ERR_MSG);
+ if (nsPtr == NULL)
+ return TCL_ERROR;
+
+ if (Tcl_Export(interp, nsPtr, specPtr->name, FALSE) != TCL_OK)
+ return TCL_ERROR;
+
+ return TCL_OK;
}