diff options
-rw-r--r-- | generic/tclCompCmds.c | 20 | ||||
-rw-r--r-- | generic/tclEncoding.c | 2 | ||||
-rw-r--r-- | generic/tclStringRep.h | 2 | ||||
-rw-r--r-- | tests/all.tcl | 2 | ||||
-rw-r--r-- | unix/Makefile.in | 1 |
5 files changed, 14 insertions, 13 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index f832420..3255e00 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -390,9 +390,9 @@ TclCompileArraySetCmd( keyVar = AnonymousLocal(envPtr); valVar = AnonymousLocal(envPtr); - infoPtr = (ForeachInfo *)Tcl_Alloc(sizeof(ForeachInfo)); + infoPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + sizeof(ForeachVarList *)); infoPtr->numLists = 1; - infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(sizeof(ForeachVarList) + sizeof(int)); + infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(int)); infoPtr->varLists[0]->numVars = 2; infoPtr->varLists[0]->varIndexes[0] = keyVar; infoPtr->varLists[0]->varIndexes[1] = valVar; @@ -1792,7 +1792,7 @@ TclCompileDictUpdateCmd( * that are to be used. */ - duiPtr = (DictUpdateInfo *)Tcl_Alloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1)); + duiPtr = (DictUpdateInfo *)Tcl_Alloc(offsetof(DictUpdateInfo, varIndices) + sizeof(int) * numVars); duiPtr->length = numVars; keyTokenPtrs = (Tcl_Token **)TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars); tokenPtr = TokenAfter(dictVarTokenPtr); @@ -2274,7 +2274,7 @@ DupDictUpdateInfo( size_t len; dui1Ptr = (DictUpdateInfo *)clientData; - len = sizeof(DictUpdateInfo) + sizeof(int) * (dui1Ptr->length - 1); + len = offsetof(DictUpdateInfo, varIndices) + sizeof(int) * dui1Ptr->length; dui2Ptr = (DictUpdateInfo *)Tcl_Alloc(len); memcpy(dui2Ptr, dui1Ptr, len); return dui2Ptr; @@ -2724,8 +2724,8 @@ CompileEachloopCmd( */ numLists = (numWords - 2)/2; - infoPtr = (ForeachInfo *)Tcl_Alloc(sizeof(ForeachInfo) - + (numLists - 1) * sizeof(ForeachVarList *)); + infoPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + + numLists * sizeof(ForeachVarList *)); infoPtr->numLists = 0; /* Count this up as we go */ /* @@ -2758,8 +2758,8 @@ CompileEachloopCmd( goto done; } - varListPtr = (ForeachVarList *)Tcl_Alloc(sizeof(ForeachVarList) - + (numVars - 1) * sizeof(int)); + varListPtr = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + + numVars * sizeof(int)); varListPtr->numVars = numVars; infoPtr->varLists[i/2] = varListPtr; infoPtr->numLists++; @@ -2896,7 +2896,7 @@ DupForeachInfo( ForeachVarList *srcListPtr, *dupListPtr; int numVars, i, j, numLists = srcPtr->numLists; - dupPtr = (ForeachInfo *)Tcl_Alloc(sizeof(ForeachInfo) + dupPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + numLists * sizeof(ForeachVarList *)); dupPtr->numLists = numLists; dupPtr->firstValueTemp = srcPtr->firstValueTemp; @@ -2905,7 +2905,7 @@ DupForeachInfo( for (i = 0; i < numLists; i++) { srcListPtr = srcPtr->varLists[i]; numVars = srcListPtr->numVars; - dupListPtr = (ForeachVarList *)Tcl_Alloc(sizeof(ForeachVarList) + dupListPtr = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + numVars * sizeof(int)); dupListPtr->numVars = numVars; for (j = 0; j < numVars; j++) { diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 49a1300..2602955 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1991,7 +1991,7 @@ LoadEscapeEncoding( Tcl_DStringFree(&lineString); } - size = sizeof(EscapeEncodingData) - sizeof(EscapeSubTable) + size = offsetof(EscapeEncodingData, subTables) + Tcl_DStringLength(&escapeData); dataPtr = (EscapeEncodingData *)Tcl_Alloc(size); dataPtr->initLen = strlen(init); diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index 73ccad6..7db83e3 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -69,7 +69,7 @@ typedef struct { } String; #define STRING_SIZE(numChars) \ - (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar))) + (offsetof(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar))) #define stringAttemptAlloc(numChars) \ (String *) Tcl_AttemptAlloc(STRING_SIZE(numChars)) #define stringAlloc(numChars) \ diff --git a/tests/all.tcl b/tests/all.tcl index 52c8763..c72334a 100644 --- a/tests/all.tcl +++ b/tests/all.tcl @@ -1,7 +1,7 @@ # all.tcl -- # # This file contains a top-level script to run all of the Tcl -# tests. Execute it by invoking "source all.test" when running tcltest +# tests. Execute it by invoking "source all.tcl" when running tcltest # in this directory. # # Copyright (c) 1998-1999 by Scriptics Corporation. diff --git a/unix/Makefile.in b/unix/Makefile.in index 74d027f..18b6de1 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -866,6 +866,7 @@ SHELL_ENV = @LD_LIBRARY_PATH_VAR@=`pwd`:${@LD_LIBRARY_PATH_VAR@} \ TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}" ${TCLTEST_EXE}: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${BUILD_DLTEST} + rm -rf $(TOP_DIR)/tests/safe-stock86.test $(MAKE) tcltest-real LIB_RUNTIME_DIR="`pwd`" tcltest-real: |