summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-04-02 18:48:01 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-04-02 18:48:01 (GMT)
commitfa49c9af9b48554cf441f2554c9cd58d3ca1f267 (patch)
tree533f6091f7eb9bb16881b234e206e374e57eb34f /generic/tclNamesp.c
parent662bbb37a4d2552ae0f59545f527731d80a47d3c (diff)
downloadtcl-fa49c9af9b48554cf441f2554c9cd58d3ca1f267.zip
tcl-fa49c9af9b48554cf441f2554c9cd58d3ca1f267.tar.gz
tcl-fa49c9af9b48554cf441f2554c9cd58d3ca1f267.tar.bz2
* generic/tclBasic.c: Replace arrays on the C stack and ckalloc
* generic/tclExecute.c: calls with TclStackAlloc calls to use memory * generic/tclFCmd.c: on Tcl's evaluation stack. * generic/tclFileName.c: * generic/tclIOCmd.c: * generic/tclIndexObj.c: * generic/tclInterp.c: * generic/tclNamesp.c: * generic/tclTrace.c: * unix/tclUnixPipe.c:
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 605a7d8..e5587fb 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -22,7 +22,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.127 2007/03/21 18:02:51 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.128 2007/04/02 18:48:04 dgp Exp $
*/
#include "tclInt.h"
@@ -4094,7 +4094,6 @@ NamespacePathCmd(
int i, nsObjc, result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
- Tcl_Namespace *staticNs[4];
if (objc > 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?pathList?");
@@ -4127,12 +4126,9 @@ NamespacePathCmd(
goto badNamespace;
}
if (nsObjc != 0) {
- if (nsObjc > 4) {
- namespaceList = (Tcl_Namespace **)
- ckalloc(sizeof(Tcl_Namespace *) * nsObjc);
- } else {
- namespaceList = staticNs;
- }
+
+ namespaceList = (Tcl_Namespace **)
+ TclStackAlloc(interp, sizeof(Tcl_Namespace *) * nsObjc);
for (i=0 ; i<nsObjc ; i++) {
if (TclGetNamespaceFromObj(interp, nsObjv[i],
@@ -4155,8 +4151,8 @@ NamespacePathCmd(
result = TCL_OK;
badNamespace:
- if (namespaceList != NULL && namespaceList != staticNs) {
- ckfree((char *) namespaceList);
+ if (namespaceList != NULL) {
+ TclStackFree(interp); /* namespaceList */
}
return result;
}