summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-03-27 22:18:55 (GMT)
committerhobbs <hobbs>2000-03-27 22:18:55 (GMT)
commit421933f19aa8d89536eea0669c57360ab504db1b (patch)
treeed74dafa9255effac95c093bbd776c37a65c5f1d /generic/tclNamesp.c
parente5c183a2a4ea443f89becd0e62024e6e242ea990 (diff)
downloadtcl-421933f19aa8d89536eea0669c57360ab504db1b.zip
tcl-421933f19aa8d89536eea0669c57360ab504db1b.tar.gz
tcl-421933f19aa8d89536eea0669c57360ab504db1b.tar.bz2
* tests/namespace.test:
* generic/tclNamesp.c (Tcl_Export): added a uniq'ing test to the export list so only one instance of each export pattern would exist in the list. * generic/tclExecute.c (TclExecuteByteCode): optimized case for the empty string in ==/!= comparisons
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index b64b6cc..43b074c 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.16 2000/01/26 21:36:35 ericm Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.17 2000/03/27 22:18:56 hobbs Exp $
*/
#include "tclInt.h"
@@ -956,6 +956,20 @@ Tcl_Export(interp, namespacePtr, pattern, resetListFirst)
}
/*
+ * Make sure that we don't already have the pattern in the array
+ */
+ if (nsPtr->exportArrayPtr != NULL) {
+ for (i = 0; i < nsPtr->numExportPatterns; i++) {
+ if (strcmp(pattern, nsPtr->exportArrayPtr[i]) == 0) {
+ /*
+ * The pattern already exists in the list
+ */
+ return TCL_OK;
+ }
+ }
+ }
+
+ /*
* Make sure there is room in the namespace's pattern array for the
* new pattern.
*/