diff options
author | stanton <stanton> | 1999-02-03 02:58:40 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-02-03 02:58:40 (GMT) |
commit | 18cb0870c48ff94988c65661ecc3b38cbcdda304 (patch) | |
tree | 21ad86d7992bf55482e4cee778b38ceb6c5abca1 /generic/tclInterp.c | |
parent | 17481a9360ea758b106cce6d9ec42c575a877eb5 (diff) | |
download | tcl-18cb0870c48ff94988c65661ecc3b38cbcdda304.zip tcl-18cb0870c48ff94988c65661ecc3b38cbcdda304.tar.gz tcl-18cb0870c48ff94988c65661ecc3b38cbcdda304.tar.bz2 |
* tests/interp.test:
* generic/tclInterp.c (DeleteAlias): Changed to use
Tcl_DeleteCommandFromToken so we handle renames properly. This
avoids senseless panic. [Bug: 736]
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 16f12c7..bdf4f72 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.3 1998/09/14 18:40:00 stanton Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.4 1999/02/03 02:58:40 stanton Exp $ */ #include <stdio.h> @@ -2005,8 +2005,6 @@ DeleteAlias(interp, slaveInterp, aliasName) Slave *slavePtr; /* Slave record for slave interpreter. */ Alias *aliasPtr; /* Points at alias structure to delete. */ Tcl_HashEntry *hPtr; /* Search variable. */ - char *tmpPtr, *namePtr; /* Local pointers to name of command to - * be deleted. */ slavePtr = (Slave *) Tcl_GetAssocData(slaveInterp, "tclSlaveRecord", NULL); @@ -2031,33 +2029,13 @@ DeleteAlias(interp, slaveInterp, aliasName) aliasPtr = (Alias *) Tcl_GetHashValue(hPtr); /* - * Get a copy of the real name of the command -- it might have - * been renamed, and we want to delete the renamed command, not - * the current command (if any) by the name of the original alias. - * We need the local copy because the name may get smashed when the - * command to delete is exposed, if it was hidden. - */ - - tmpPtr = Tcl_GetCommandName(slaveInterp, aliasPtr->slaveCmd); - namePtr = (char *) ckalloc((unsigned) strlen(tmpPtr) + 1); - strcpy(namePtr, tmpPtr); - - /* * NOTE: The deleteProc for this command will delete the * alias from the hash table. The deleteProc will also * delete the target information from the master interpreter * target table. */ - if (Tcl_DeleteCommand(slaveInterp, namePtr) != 0) { - if (Tcl_ExposeCommand(slaveInterp, namePtr, namePtr) != TCL_OK) { - panic("DeleteAlias: did not find alias to be deleted"); - } - if (Tcl_DeleteCommand(slaveInterp, namePtr) != 0) { - panic("DeleteAlias: did not find alias to be deleted"); - } - } - ckfree(namePtr); + (void) Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd); return TCL_OK; } |