summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.h12
-rw-r--r--generic/tclCompCmds.c10
-rw-r--r--generic/tclResult.c4
3 files changed, 12 insertions, 14 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index af46ad9..8c4bbbb 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.231.2.8 2007/10/15 18:38:06 dgp Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.231.2.9 2007/10/19 14:30:01 dgp Exp $
*/
#ifndef _TCL
@@ -350,10 +350,6 @@ typedef long LONG;
* Note on converting between Tcl_WideInt and strings. This implementation (in
* tclObj.c) depends on the function
* sprintf(...,"%" TCL_LL_MODIFIER "d",...).
- * TCL_LL_MODIFIER_SIZE is the length of the
- * modifier string, which is "ll" on most 32-bit Unix systems. It has to be
- * split up like this to allow for the more complex formats sometimes needed
- * (e.g. in the format(n) command.)
*/
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
@@ -361,10 +357,8 @@ typedef long LONG;
# define TCL_WIDE_INT_TYPE long long
# if defined(__WIN32__) && !defined(__CYGWIN__)
# define TCL_LL_MODIFIER "I64"
-# define TCL_LL_MODIFIER_SIZE 3
# else
# define TCL_LL_MODIFIER "L"
-# define TCL_LL_MODIFIER_SIZE 1
# endif
typedef struct stat Tcl_StatBuf;
# elif defined(__WIN32__)
@@ -372,7 +366,6 @@ typedef struct stat Tcl_StatBuf;
# ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
# define TCL_LL_MODIFIER "L"
-# define TCL_LL_MODIFIER_SIZE 1
# else /* __BORLANDC__ */
# if _MSC_VER < 1400 || !defined(_M_IX86)
typedef struct _stati64 Tcl_StatBuf;
@@ -380,7 +373,6 @@ typedef struct _stati64 Tcl_StatBuf;
typedef struct _stat64 Tcl_StatBuf;
# endif /* _MSC_VER < 1400 */
# define TCL_LL_MODIFIER "I64"
-# define TCL_LL_MODIFIER_SIZE 3
# endif /* __BORLANDC__ */
# else /* __WIN32__ */
/*
@@ -415,7 +407,6 @@ typedef struct stat Tcl_StatBuf;
# define Tcl_DoubleAsWide(val) ((long)((double)(val)))
# ifndef TCL_LL_MODIFIER
# define TCL_LL_MODIFIER "l"
-# define TCL_LL_MODIFIER_SIZE 1
# endif /* !TCL_LL_MODIFIER */
#else /* TCL_WIDE_INT_IS_LONG */
/*
@@ -429,7 +420,6 @@ typedef struct stat64 Tcl_StatBuf;
typedef struct stat Tcl_StatBuf;
# endif /* HAVE_STRUCT_STAT64 */
# define TCL_LL_MODIFIER "ll"
-# define TCL_LL_MODIFIER_SIZE 2
# endif /* !TCL_LL_MODIFIER */
# define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val)))
# define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val)))
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index ee5a8cd..6468ea9 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.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: tclCompCmds.c,v 1.109.2.8 2007/10/02 20:11:54 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.109.2.9 2007/10/19 14:30:01 dgp Exp $
*/
#include "tclInt.h"
@@ -3088,7 +3088,7 @@ TclCompileReturnCmd(
* General syntax: [return ?-option value ...? ?result?]
* An even number of words means an explicit result argument is present.
*/
- int level, code, objc, status = TCL_OK;
+ int level, code, objc, size, status = TCL_OK;
int numWords = parsePtr->numWords;
int explicitResult = (0 == (numWords % 2));
int numOptionWords = numWords - 1 - explicitResult;
@@ -3208,6 +3208,12 @@ TclCompileReturnCmd(
}
}
+ /* Optimize [return -level 0 $x]. */
+ Tcl_DictObjSize(NULL, returnOpts, &size);
+ if (size == 0 && level == 0 && code == TCL_OK) {
+ return TCL_OK;
+ }
+
/*
* Could not use the optimization, so we push the return options dict, and
* emit the INST_RETURN_IMM instruction with code and level as operands.
diff --git a/generic/tclResult.c b/generic/tclResult.c
index eaaa61d..22e0bd0 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclResult.c,v 1.36.2.2 2007/09/07 20:20:55 dgp Exp $
+ * RCS: @(#) $Id: tclResult.c,v 1.36.2.3 2007/10/19 14:30:01 dgp Exp $
*/
#include "tclInt.h"
@@ -1352,6 +1352,8 @@ TclMergeReturnOptions(
"continue, or an integer", NULL);
goto error;
}
+ }
+ if (valuePtr != NULL) {
Tcl_DictObjRemove(NULL, returnOpts, keys[KEY_CODE]);
}