summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-10-12 23:54:08 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-10-12 23:54:08 (GMT)
commit8f3a5542f70462ef54213933a400db8249c02b81 (patch)
tree6076e235fe04991dd6c22309feb9d9bbc207dbf6
parentd20dc9468524343c90f73e486937c12f9b0fc244 (diff)
downloadtcl-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--ChangeLog6
-rw-r--r--generic/tclExecute.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2149126..37fca42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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