diff options
author | dgp <dgp@noemail.net> | 2005-07-05 17:27:06 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2005-07-05 17:27:06 (GMT) |
commit | 78219a1b595b0a2959d3525cd0691a2125a1a358 (patch) | |
tree | cef3768290a51e324c8309559e41773898412085 /generic/tclNamesp.c | |
parent | f9ac4fd22b658bf12a1db46ff2bfd876afaa2b70 (diff) | |
download | tcl-78219a1b595b0a2959d3525cd0691a2125a1a358.zip tcl-78219a1b595b0a2959d3525cd0691a2125a1a358.tar.gz tcl-78219a1b595b0a2959d3525cd0691a2125a1a358.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]
FossilOrigin-Name: 18818ddf02f729281c01620284803b42839867f7
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r-- | generic/tclNamesp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 55e92af..3eb1bb2 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -19,7 +19,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.31.2.6 2004/10/05 16:22:34 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.31.2.7 2005/07/05 17:27:08 dgp Exp $ */ #include "tclInt.h" @@ -1277,6 +1277,16 @@ Tcl_Import(interp, namespacePtr, pattern, 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_AppendStringsToObj(Tcl_GetObjResult(interp), "can't import command \"", cmdName, "\": already exists", (char *) NULL); |