diff options
author | dgp <dgp@users.sourceforge.net> | 2005-10-12 23:54:08 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-10-12 23:54:08 (GMT) |
commit | 8f3a5542f70462ef54213933a400db8249c02b81 (patch) | |
tree | 6076e235fe04991dd6c22309feb9d9bbc207dbf6 | |
parent | d20dc9468524343c90f73e486937c12f9b0fc244 (diff) | |
download | tcl-8f3a5542f70462ef54213933a400db8249c02b81.zip tcl-8f3a5542f70462ef54213933a400db8249c02b81.tar.gz tcl-8f3a5542f70462ef54213933a400db8249c02b81.tar.bz2 |
* generic/tclExecute.c (GetNumberFromObj): Restored some lost
optimizations for empty string values. We avoid cost of a call to
TclParseNumber just to tell us an empty string isn't a number.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclExecute.c | 8 |
2 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2005-10-12 Don Porter <dgp@users.sourceforge.net> + + * generic/tclExecute.c (GetNumberFromObj): Restored some lost + optimizations for empty string values. We avoid cost of a call to + TclParseNumber just to tell us an empty string isn't a number. + 2005-10-12 Donal K. Fellows <dkf@users.sf.net> * generic/tclPathObj.c (SetFsPathFromAny): TclGetString macro must diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 210171a..27e86d6 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.208 2005/10/12 18:31:34 kennykb Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.209 2005/10/12 23:54:09 dgp Exp $ */ #include "tclInt.h" @@ -352,6 +352,9 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 }; : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ + ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ + ? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #else @@ -371,6 +374,9 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 }; : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ + ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ + ? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #endif |