diff options
| author | pooryorick <com.digitalsmarties@pooryorick.com> | 2018-02-15 10:23:53 (GMT) |
|---|---|---|
| committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2018-02-15 10:23:53 (GMT) |
| commit | beff988e7935366ac75de253ef79ece6042b7865 (patch) | |
| tree | b1efabcd9e783e00f55e0ce1ce8b2573166f0486 | |
| parent | e8f10bd44ea5fa445417a6d100d0bada8c5f0462 (diff) | |
| download | tcl-beff988e7935366ac75de253ef79ece6042b7865.zip tcl-beff988e7935366ac75de253ef79ece6042b7865.tar.gz tcl-beff988e7935366ac75de253ef79ece6042b7865.tar.bz2 | |
Rearrange a few lines TclRenameCommand to reduce operations.
| -rw-r--r-- | generic/tclBasic.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 3fb099b..3ac3ffd 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2609,10 +2609,6 @@ TclRenameCommand( Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COMMAND", oldName, NULL); return TCL_ERROR; } - cmdNsPtr = cmdPtr->nsPtr; - oldFullName = Tcl_NewObj(); - Tcl_IncrRefCount(oldFullName); - Tcl_GetCommandFullName(interp, cmd, oldFullName); /* * If the new command name is NULL or empty, delete the command. Do this @@ -2621,10 +2617,14 @@ TclRenameCommand( if ((newName == NULL) || (*newName == '\0')) { Tcl_DeleteCommandFromToken(interp, cmd); - result = TCL_OK; - goto done; + return TCL_OK; } + cmdNsPtr = cmdPtr->nsPtr; + oldFullName = Tcl_NewObj(); + Tcl_IncrRefCount(oldFullName); + Tcl_GetCommandFullName(interp, cmd, oldFullName); + /* * Make sure that the destination command does not already exist. The * rename operation is like creating a command, so we should automatically |
