diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-10 13:17:51 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-10 13:17:51 (GMT) |
commit | 094ae2eaba162bbf71de484af207525f6cd79273 (patch) | |
tree | d8a34d2cbc81e6bc796eda193b958269f5cab158 /generic/tclListObj.c | |
parent | 75092eb2cfb1a905b9d4cfef45dbf5ce2c4cc992 (diff) | |
download | tcl-094ae2eaba162bbf71de484af207525f6cd79273.zip tcl-094ae2eaba162bbf71de484af207525f6cd79273.tar.gz tcl-094ae2eaba162bbf71de484af207525f6cd79273.tar.bz2 |
Fix efficiency bug detected by Kieran Elby.
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 2bbaa22..95e3f33 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.49.2.1 2008/07/20 22:02:39 dkf Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.49.2.2 2008/09/10 13:18:11 dkf Exp $ */ #include "tclInt.h" @@ -428,7 +428,16 @@ Tcl_ListObjGetElements( if (listPtr->typePtr != &tclListType) { int result, length; - (void) TclGetStringFromObj(listPtr, &length); + /* + * Don't get the string version of a dictionary; that transformation + * is not lossy, but is expensive. + */ + + if (listPtr->typePtr == &tclDictType) { + (void) Tcl_DictObjSize(NULL, listPtr, &length); + } else { + (void) TclGetStringFromObj(listPtr, &length); + } if (!length) { *objcPtr = 0; *objvPtr = NULL; |