summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-01-23 21:21:26 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-01-23 21:21:26 (GMT)
commit0631e4f3f4260d3fbc773676389783ec4d31c480 (patch)
treea1b52e7723f15d31eb1d37d49c9cc69b7d9cf7cd
parentf7f6ddb4ce3ce465107777a9a2c408dd8ab473dc (diff)
downloadtcl-0631e4f3f4260d3fbc773676389783ec4d31c480.zip
tcl-0631e4f3f4260d3fbc773676389783ec4d31c480.tar.gz
tcl-0631e4f3f4260d3fbc773676389783ec4d31c480.tar.bz2
Reconcile coding style issues between branches
-rw-r--r--generic/tclBasic.c9
-rw-r--r--generic/tclCompile.c5
-rw-r--r--generic/tclExecute.c15
-rw-r--r--generic/tclIOUtil.c18
-rw-r--r--generic/tclInt.h72
5 files changed, 60 insertions, 59 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index bd2305c..35c6bb9 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.290 2008/01/15 11:59:26 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.291 2008/01/23 21:21:26 dgp Exp $
*/
#include "tclInt.h"
@@ -3588,7 +3588,7 @@ TclEvalObjvInternal(
*/
cmdPtr->refCount++;
- if (iPtr->tracePtr && (traceCode == TCL_OK)) {
+ if (iPtr->tracePtr && (traceCode == TCL_OK)) {
traceCode = TclCheckInterpTraces(interp, command, length,
cmdPtr, code, TCL_TRACE_ENTER_EXEC, objc, objv);
}
@@ -4097,7 +4097,7 @@ TclEvalEx(
Tcl_Obj *norm = Tcl_FSGetNormalizedPath(interp, iPtr->scriptFile);
- if (!norm) {
+ if (norm == NULL) {
/*
* Error message in the interp result.
*/
@@ -4118,8 +4118,7 @@ TclEvalEx(
eeFramePtr->data.eval.path = NULL;
}
- eeFramePtr->level =
- (iPtr->cmdFramePtr==NULL ? 1 : iPtr->cmdFramePtr->level+1);
+ eeFramePtr->level = iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level + 1 : 1;
eeFramePtr->framePtr = iPtr->framePtr;
eeFramePtr->nextPtr = iPtr->cmdFramePtr;
eeFramePtr->nline = 0;
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index b4f4d97..4b68c40 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.145 2008/01/16 21:05:48 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.146 2008/01/23 21:21:30 dgp Exp $
*/
#include "tclInt.h"
@@ -1694,7 +1694,8 @@ TclCompileTokens(
break;
default:
- Tcl_Panic("Unexpected token type in TclCompileTokens");
+ Tcl_Panic("Unexpected token type in TclCompileTokens: %d; %.*s",
+ tokenPtr->type, tokenPtr->size, tokenPtr->start);
}
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index d28fd74..726b585 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -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: tclExecute.c,v 1.360 2008/01/16 21:05:48 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.361 2008/01/23 21:21:31 dgp Exp $
*/
#include "tclInt.h"
@@ -1339,8 +1339,8 @@ TclCompEvalObj(
iPtr->numLevels++;
if (TclInterpReady(interp) == TCL_ERROR) {
- iPtr->numLevels--;
- return TCL_ERROR;
+ result = TCL_ERROR;
+ goto done;
}
namespacePtr = iPtr->varFramePtr->nsPtr;
@@ -1404,8 +1404,7 @@ TclCompEvalObj(
if (codePtr->refCount <= 0) {
TclCleanupByteCode(codePtr);
}
- iPtr->numLevels--;
- return result;
+ goto done;
}
recompileObj:
@@ -1424,6 +1423,10 @@ TclCompEvalObj(
iPtr->invokeCmdFramePtr = NULL;
codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
goto runCompiledObj;
+
+ done:
+ iPtr->numLevels--;
+ return result;
}
/*
@@ -2404,7 +2407,7 @@ TclExecuteByteCode(
* context.
*/
- result = TclCompEvalObj(interp, objPtr, NULL,0);
+ result = TclCompEvalObj(interp, objPtr, NULL, 0);
CACHE_STACK_INFO();
if (result == TCL_OK) {
/*
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 50645fa..c996b1f 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.149 2007/12/14 23:36:09 hobbs Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.150 2008/01/23 21:21:31 dgp Exp $
*/
#include "tclInt.h"
@@ -1755,7 +1755,7 @@ Tcl_FSEvalFileEx(
const char *encodingName) /* If non-NULL, then use this encoding for the
* file. NULL means use the system encoding. */
{
- int result, length;
+ int length, result = TCL_ERROR;
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile;
Interp *iPtr;
@@ -1764,25 +1764,21 @@ Tcl_FSEvalFileEx(
Tcl_Obj *objPtr;
if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) {
- return TCL_ERROR;
+ return result;
}
- result = TCL_ERROR;
- objPtr = Tcl_NewObj();
- Tcl_IncrRefCount(objPtr);
-
if (Tcl_FSStat(pathPtr, &statBuf) == -1) {
Tcl_SetErrno(errno);
Tcl_AppendResult(interp, "couldn't read file \"",
Tcl_GetString(pathPtr), "\": ", Tcl_PosixError(interp), NULL);
- goto end;
+ return result;
}
chan = Tcl_FSOpenFileChannel(interp, pathPtr, "r", 0644);
if (chan == (Tcl_Channel) NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't read file \"",
Tcl_GetString(pathPtr), "\": ", Tcl_PosixError(interp), NULL);
- goto end;
+ return result;
}
/*
@@ -1801,10 +1797,12 @@ Tcl_FSEvalFileEx(
if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
!= TCL_OK) {
Tcl_Close(interp,chan);
- goto end;
+ return result;
}
}
+ objPtr = Tcl_NewObj();
+ Tcl_IncrRefCount(objPtr);
if (Tcl_ReadChars(chan, objPtr, -1, 0) < 0) {
Tcl_Close(interp, chan);
Tcl_AppendResult(interp, "couldn't read file \"",
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 975771f..023cd69 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.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: tclInt.h,v 1.360 2008/01/23 19:41:28 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.361 2008/01/23 21:21:31 dgp Exp $
*/
#ifndef _TCLINT
@@ -3506,45 +3506,45 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr);
* the same growth algorithm as used in tclStringObj.c for growing
* strings. The ANSI C "prototype" for this macro is:
*
- * EXTERN void TclGrowTokenArray _ANSI_ARGS_((Tcl_Token *tokenPtr,
- * int used, int available, int append,
- * Tcl_Token *staticPtr));
- * EXTERN void TclGrowParseTokenArray _ANSI_ARGS_((Tcl_Parse *parsePtr,
- * int append));
+ * MODULE_SCOPE void TclGrowTokenArray(Tcl_Token *tokenPtr, int used,
+ * int available, int append,
+ * Tcl_Token *staticPtr);
+ * MODULE_SCOPR void TclGrowParseTokenArray(Tcl_Parse *parsePtr,
+ * int append);
*----------------------------------------------------------------
*/
#define TCL_MIN_TOKEN_GROWTH 50
-#define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \
- { \
- int needed = (used) + (append); \
- if (needed > (available)) { \
- int allocated = 2 * needed; \
- Tcl_Token *oldPtr = (tokenPtr); \
- Tcl_Token *newPtr; \
- if (oldPtr == (staticPtr)) { \
- oldPtr = NULL; \
- } \
- newPtr = (Tcl_Token *) attemptckrealloc( (char *) oldPtr, \
- (unsigned int) (allocated * sizeof(Tcl_Token)) ); \
- if (newPtr == NULL) { \
- allocated = needed + (append) + TCL_MIN_TOKEN_GROWTH; \
- newPtr = (Tcl_Token *) ckrealloc( (char *) oldPtr, \
- (unsigned int) (allocated * sizeof(Tcl_Token)) );\
- } \
- (available) = allocated; \
- if (oldPtr == NULL) { \
- memcpy((VOID *) newPtr, (VOID *) staticPtr, \
- (size_t) ((used) * sizeof(Tcl_Token))); \
- } \
- (tokenPtr) = newPtr; \
- } \
- }
-
-#define TclGrowParseTokenArray(parsePtr, append) \
- TclGrowTokenArray((parsePtr)->tokenPtr, (parsePtr)->numTokens, \
- (parsePtr)->tokensAvailable, (append), \
- (parsePtr)->staticTokens)
+#define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \
+{ \
+ int needed = (used) + (append); \
+ if (needed > (available)) { \
+ int allocated = 2 * needed; \
+ Tcl_Token *oldPtr = (tokenPtr); \
+ Tcl_Token *newPtr; \
+ if (oldPtr == (staticPtr)) { \
+ oldPtr = NULL; \
+ } \
+ newPtr = (Tcl_Token *) attemptckrealloc( (char *) oldPtr, \
+ (unsigned int) (allocated * sizeof(Tcl_Token)) ); \
+ if (newPtr == NULL) { \
+ allocated = needed + (append) + TCL_MIN_TOKEN_GROWTH; \
+ newPtr = (Tcl_Token *) ckrealloc( (char *) oldPtr, \
+ (unsigned int) (allocated * sizeof(Tcl_Token)) ); \
+ } \
+ (available) = allocated; \
+ if (oldPtr == NULL) { \
+ memcpy((VOID *) newPtr, (VOID *) staticPtr, \
+ (size_t) ((used) * sizeof(Tcl_Token))); \
+ } \
+ (tokenPtr) = newPtr; \
+ } \
+}
+
+#define TclGrowParseTokenArray(parsePtr, append) \
+ TclGrowTokenArray((parsePtr)->tokenPtr, (parsePtr)->numTokens, \
+ (parsePtr)->tokensAvailable, (append), \
+ (parsePtr)->staticTokens)
/*
*----------------------------------------------------------------