summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-07-05 17:33:06 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-07-05 17:33:06 (GMT)
commit1f35b60c45319b66403716359b926d67f7d9b328 (patch)
treefb9686aab851216c3b0d253f6cfd274b4d08b216 /generic
parent8c0298c965815529184e64e8356e55d9cd7ba8c2 (diff)
downloadtcl-1f35b60c45319b66403716359b926d67f7d9b328.zip
tcl-1f35b60c45319b66403716359b926d67f7d9b328.tar.gz
tcl-1f35b60c45319b66403716359b926d67f7d9b328.tar.bz2
* generic/tclNamesp.c: Allow for [namespace import] of a command
* tests/namespace.test: over a previous [namespace import] of itself without throwing an error. [RFE 1230597]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclNamesp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 9935f47..f1a86d6 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -21,7 +21,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.77 2005/06/07 21:46:18 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.78 2005/07/05 17:33:06 dgp Exp $
*/
#include "tclInt.h"
@@ -1639,6 +1639,15 @@ DoImport(interp, nsPtr, hPtr, cmdName, pattern, importNsPtr, allowOverwrite)
refPtr->nextPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = refPtr;
} else {
+ Command *overwrite = (Command *) Tcl_GetHashValue(found);
+ if (overwrite->deleteProc == DeleteImportedCmd) {
+ ImportedCmdData *dataPtr =
+ (ImportedCmdData *) overwrite->objClientData;
+ if (dataPtr->realCmdPtr == (Command *) Tcl_GetHashValue(hPtr)) {
+ /* Repeated import of same command -- acceptable */
+ return TCL_OK;
+ }
+ }
Tcl_AppendResult(interp, "can't import command \"", cmdName,
"\": already exists", (char *) NULL);
return TCL_ERROR;