diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-14 09:46:54 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-14 09:46:54 (GMT) |
| commit | 04cc75b6f5e3fd31abae4090243d20e965f9d4e4 (patch) | |
| tree | 86704418da067f040cd949bb5bdc0add5449c8fc | |
| parent | 320e9f1a3cd1bdde8e8d13e542c8d71ea595b780 (diff) | |
| parent | 683756c1bdcc1745f0953b26f798154e1fdff5a1 (diff) | |
| download | tcl-04cc75b6f5e3fd31abae4090243d20e965f9d4e4.zip tcl-04cc75b6f5e3fd31abae4090243d20e965f9d4e4.tar.gz tcl-04cc75b6f5e3fd31abae4090243d20e965f9d4e4.tar.bz2 | |
In some places, Tcl_UtfPrev()/Tcl_UtfNext() is used traversing the individual bytes of a string searching for '(', ')', '::' or other single bytes. It is overkill to use Tcl_UtfPrev/Tcl_UtfNext for that, since those characters can only appear as their ASCII byte, not as any other sequence.
This effectively removes the last Tcl_UtfNext() call from the core, the only ones left are in tclTest.c for test commands. So the TclUtfNext() macro doesn't make sense any more.
Remove "register" keyword from many files.
| -rw-r--r-- | generic/tclCompCmds.c | 68 | ||||
| -rw-r--r-- | generic/tclCompCmdsGR.c | 42 | ||||
| -rw-r--r-- | generic/tclCompCmdsSZ.c | 40 | ||||
| -rw-r--r-- | generic/tclCompile.c | 62 | ||||
| -rw-r--r-- | generic/tclEnsemble.c | 12 | ||||
| -rw-r--r-- | generic/tclInt.h | 3 | ||||
| -rw-r--r-- | generic/tclProc.c | 90 | ||||
| -rw-r--r-- | generic/tclTest.c | 6 | ||||
| -rw-r--r-- | generic/tclUtil.c | 9 |
9 files changed, 163 insertions, 169 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index d8f0aeb..607521d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -138,9 +138,9 @@ TclCompileAppendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -587,10 +587,10 @@ TclCompileCatchCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; int resultIndex, optsIndex, range, dropScript = 0; - DefineLineInformation; /* TIP #280 */ int depth = TclGetStackDepth(envPtr); /* @@ -620,13 +620,11 @@ TclCompileCatchCmd( cmdTokenPtr = TokenAfter(parsePtr->tokenPtr); if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); - /* DGP */ resultIndex = LocalScalarFromToken(resultNameTokenPtr, envPtr); if (resultIndex < 0) { return TCL_ERROR; } - /* DKF */ if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); optsIndex = LocalScalarFromToken(optsNameTokenPtr, envPtr); @@ -1022,10 +1020,9 @@ TclCompileDictSetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; - int i, dictVarIndex; DefineLineInformation; /* TIP #280 */ - Tcl_Token *varTokenPtr; + Tcl_Token *tokenPtr, *varTokenPtr; + int i, dictVarIndex; /* * There must be at least one argument after the command. @@ -1148,9 +1145,9 @@ TclCompileDictGetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i; - DefineLineInformation; /* TIP #280 */ /* * There must be at least two arguments after the command (the single-arg @@ -1185,9 +1182,9 @@ TclCompileDictExistsCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int i; - DefineLineInformation; /* TIP #280 */ /* * There must be at least two arguments after the command (the single-arg @@ -1222,8 +1219,8 @@ TclCompileDictUnsetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; int i, dictVarIndex; /* @@ -2338,13 +2335,13 @@ TclCompileErrorCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; + /* * General syntax: [error message ?errorInfo? ?errorCode?] */ - Tcl_Token *tokenPtr; - DefineLineInformation; /* TIP #280 */ - if (parsePtr->numWords < 2 || parsePtr->numWords > 4) { return TCL_ERROR; } @@ -2457,11 +2454,11 @@ TclCompileForCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr; JumpFixup jumpEvalCondFixup; int bodyCodeOffset, nextCodeOffset, jumpDist; int bodyRange, nextRange; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 5) { return TCL_ERROR; @@ -2670,6 +2667,7 @@ CompileEachloopCmd( int collect) /* Select collecting or accumulating mode * (TCL_EACH_*) */ { + DefineLineInformation; /* TIP #280 */ Proc *procPtr = envPtr->procPtr; ForeachInfo *infoPtr=NULL; /* Points to the structure describing this * foreach command. Stored in a AuxData @@ -2679,7 +2677,6 @@ CompileEachloopCmd( int jumpBackOffset, infoIndex, range; int numWords, numLists, i, j, code = TCL_OK; Tcl_Obj *varListObj = NULL; - DefineLineInformation; /* TIP #280 */ /* * If the foreach command isn't in a procedure, don't compile it inline: @@ -2880,9 +2877,9 @@ DupForeachInfo( ClientData clientData) /* The foreach command's compilation auxiliary * data to duplicate. */ { - register ForeachInfo *srcPtr = clientData; + ForeachInfo *srcPtr = clientData; ForeachInfo *dupPtr; - register ForeachVarList *srcListPtr, *dupListPtr; + ForeachVarList *srcListPtr, *dupListPtr; int numVars, i, j, numLists = srcPtr->numLists; dupPtr = ckalloc(sizeof(ForeachInfo) @@ -2929,10 +2926,10 @@ FreeForeachInfo( ClientData clientData) /* The foreach command's compilation auxiliary * data to free. */ { - register ForeachInfo *infoPtr = clientData; - register ForeachVarList *listPtr; + ForeachInfo *infoPtr = clientData; + ForeachVarList *listPtr; int numLists = infoPtr->numLists; - register int i; + int i; for (i = 0; i < numLists; i++) { listPtr = infoPtr->varLists[i]; @@ -2965,8 +2962,8 @@ PrintForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - register ForeachInfo *infoPtr = clientData; - register ForeachVarList *varsPtr; + ForeachInfo *infoPtr = clientData; + ForeachVarList *varsPtr; int i, j; Tcl_AppendToObj(appendObj, "data=[", -1); @@ -3005,8 +3002,8 @@ PrintNewForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - register ForeachInfo *infoPtr = clientData; - register ForeachVarList *varsPtr; + ForeachInfo *infoPtr = clientData; + ForeachVarList *varsPtr; int i, j; Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+d, vars=", @@ -3035,8 +3032,8 @@ DisassembleForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - register ForeachInfo *infoPtr = clientData; - register ForeachVarList *varsPtr; + ForeachInfo *infoPtr = clientData; + ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; @@ -3082,8 +3079,8 @@ DisassembleNewForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - register ForeachInfo *infoPtr = clientData; - register ForeachVarList *varsPtr; + ForeachInfo *infoPtr = clientData; + ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; @@ -3407,9 +3404,9 @@ TclPushVarName( int *localIndexPtr, /* Must not be NULL. */ int *isScalarPtr) /* Must not be NULL. */ { - register const char *p; + const char *p; const char *last, *name, *elName; - register int n; + int n; Tcl_Token *elemTokenPtr = NULL; int nameLen, elNameLen, simpleVarName, localIndex; int elemTokenCount = 0, allocedTokens = 0, removedParen = 0; @@ -3441,10 +3438,10 @@ TclPushVarName( /* * last char is ')' => potential array reference. */ - last = Tcl_UtfPrev(name + nameLen, name); + last = &name[nameLen-1]; if (*last == ')') { - for (p = name; p < last; p = Tcl_UtfNext(p)) { + for (p = name; p < last; p++) { if (*p == '(') { elName = p + 1; elNameLen = last - elName; @@ -3472,15 +3469,14 @@ TclPushVarName( } else if (interp && ((n = varTokenPtr->numComponents) > 1) && (varTokenPtr[1].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].type == TCL_TOKEN_TEXT) - && (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')') - && (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) { + && (*(varTokenPtr[n].start + varTokenPtr[n].size - 1) == ')')) { /* * Check for parentheses inside first token. */ simpleVarName = 0; for (p = varTokenPtr[1].start, - last = p + varTokenPtr[1].size; p < last; p = Tcl_UtfNext(p)) { + last = p + varTokenPtr[1].size; p < last; p++) { if (*p == '(') { simpleVarName = 1; break; @@ -3548,7 +3544,7 @@ TclPushVarName( int hasNsQualifiers = 0; - for (p = name, last = p + nameLen-1; p < last; p = Tcl_UtfNext(p)) { + for (p = name, last = p + nameLen-1; p < last; p++) { if ((*p == ':') && (*(p+1) == ':')) { hasNsQualifiers = 1; break; diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 324db41..4207df7 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -91,9 +91,9 @@ TclCompileGlobalCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -170,6 +170,7 @@ TclCompileIfCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ JumpFixupArray jumpFalseFixupArray; /* Used to fix the ifFalse jump after each * test when its target PC is determined. */ @@ -185,7 +186,6 @@ TclCompileIfCmd( * "if 0 {..}" */ int boolVal; /* Value of static condition. */ int compileScripts = 1; - DefineLineInformation; /* TIP #280 */ /* * Only compile the "if" command if all arguments are simple words, in @@ -473,9 +473,9 @@ TclCompileIncrCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *incrTokenPtr; int isScalar, localIndex, haveImmValue, immValue; - DefineLineInformation; /* TIP #280 */ if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { return TCL_ERROR; @@ -670,9 +670,9 @@ TclCompileInfoExistsCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int isScalar, localIndex; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -848,9 +848,9 @@ TclCompileLappendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -964,9 +964,9 @@ TclCompileLassignCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int isScalar, localIndex, numWords, idx; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -1068,9 +1068,9 @@ TclCompileLindexCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *idxTokenPtr, *valTokenPtr; int i, idx, numWords = parsePtr->numWords; - DefineLineInformation; /* TIP #280 */ /* * Quit if too few args. @@ -1273,8 +1273,8 @@ TclCompileLlengthCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *varTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *varTokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1306,8 +1306,8 @@ TclCompileLrangeCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx1, idx2; if (parsePtr->numWords != 4) { @@ -1367,8 +1367,8 @@ TclCompileLinsertCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx, i; if (parsePtr->numWords < 3) { @@ -1470,8 +1470,8 @@ TclCompileLreplaceCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *listTokenPtr; int idx1, idx2, i; int emptyPrefix=1, suffixStart = 0; @@ -1634,6 +1634,7 @@ TclCompileLsetCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int tempDepth; /* Depth used for emitting one part of the * code burst. */ Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the @@ -1641,7 +1642,6 @@ TclCompileLsetCmd( int localIndex; /* Index of var in local var table. */ int isScalar; /* Flag == 1 if scalar, 0 if array. */ int i; - DefineLineInformation; /* TIP #280 */ /* * Check argument count. @@ -1806,8 +1806,8 @@ TclCompileNamespaceCodeCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1856,8 +1856,8 @@ TclCompileNamespaceOriginCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1878,8 +1878,8 @@ TclCompileNamespaceQualifiersCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int off; if (parsePtr->numWords != 2) { @@ -1914,8 +1914,8 @@ TclCompileNamespaceTailCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); JumpFixup jumpFixup; if (parsePtr->numWords != 2) { @@ -1951,9 +1951,9 @@ TclCompileNamespaceUpvarCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ if (envPtr->procPtr == NULL) { return TCL_ERROR; @@ -2076,11 +2076,11 @@ TclCompileRegexpCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the * parse of the RE or string. */ int i, len, nocase, exact, sawLast, simple; const char *str; - DefineLineInformation; /* TIP #280 */ /* * We are only interested in compiling simple regexp cases. Currently @@ -2416,6 +2416,7 @@ TclCompileReturnCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ /* * General syntax: [return ?-option value ...? ?result?] * An even number of words means an explicit result argument is present. @@ -2426,7 +2427,6 @@ TclCompileReturnCmd( int numOptionWords = numWords - 1 - explicitResult; Tcl_Obj *returnOpts, **objv; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); - DefineLineInformation; /* TIP #280 */ /* * Check for special case which can always be compiled: @@ -2668,9 +2668,9 @@ TclCompileUpvarCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr; if (envPtr->procPtr == NULL) { @@ -2775,9 +2775,9 @@ TclCompileVariableCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; if (numWords < 2) { diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 1ce4582..31e2c88 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -135,9 +135,9 @@ TclCompileSetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *valueTokenPtr; int isAssignment, isScalar, localIndex, numWords; - DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; if ((numWords != 2) && (numWords != 3)) { @@ -229,10 +229,10 @@ TclCompileStringCatCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int i, numWords = parsePtr->numWords, numArgs; Tcl_Token *wordTokenPtr; Tcl_Obj *obj, *folded; - DefineLineInformation; /* TIP #280 */ /* Trivial case, no arg */ @@ -996,8 +996,8 @@ TclCompileStringReplaceCmd( * compiled. */ CompileEnv *envPtr) /* Holds the resulting instructions. */ { - Tcl_Token *tokenPtr, *valueTokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *valueTokenPtr; int first, last; if (parsePtr->numWords < 4 || parsePtr->numWords > 5) { @@ -1403,13 +1403,13 @@ TclCompileSubstCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ int numArgs = parsePtr->numWords - 1; int numOpts = numArgs - 1; int objc, flags = TCL_SUBST_ALL; Tcl_Obj **objv/*, *toSubst = NULL*/; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); int code = TCL_ERROR; - DefineLineInformation; /* TIP #280 */ if (numArgs == 0) { return TCL_ERROR; @@ -1736,6 +1736,7 @@ TclCompileSwitchCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; /* Pointer to tokens in command. */ int numWords; /* Number of words in command. */ @@ -1752,7 +1753,6 @@ TclCompileSwitchCmd( int foundMode = 0; /* Have we seen a mode flag yet? */ int i, valueIndex; int result = TCL_ERROR; - DefineLineInformation; /* TIP #280 */ int *clNext = envPtr->clNext; /* @@ -1800,8 +1800,8 @@ TclCompileSwitchCmd( */ for (; numWords>=3 ; tokenPtr=TokenAfter(tokenPtr),numWords--) { - register unsigned size = tokenPtr[1].size; - register const char *chrs = tokenPtr[1].start; + unsigned size = tokenPtr[1].size; + const char *chrs = tokenPtr[1].start; /* * We only process literal options, and we assume that -e, -g and -n @@ -2540,7 +2540,7 @@ PrintJumptableInfo( ByteCode *codePtr, unsigned int pcOffset) { - register JumptableInfo *jtPtr = clientData; + JumptableInfo *jtPtr = clientData; Tcl_HashEntry *hPtr; Tcl_HashSearch search; const char *keyPtr; @@ -2569,7 +2569,7 @@ DisassembleJumptableInfo( ByteCode *codePtr, unsigned int pcOffset) { - register JumptableInfo *jtPtr = clientData; + JumptableInfo *jtPtr = clientData; Tcl_Obj *mapping = Tcl_NewObj(); Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -3574,9 +3574,9 @@ TclCompileUnsetCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0; - DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ @@ -3712,13 +3712,13 @@ TclCompileWhileCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; /* TIP #280 */ Tcl_Token *testTokenPtr, *bodyTokenPtr; JumpFixup jumpEvalCondFixup; int testCodeOffset, bodyCodeOffset, jumpDist, range, code, boolVal; int loopMayEnd = 1; /* This is set to 0 if it is recognized as an * infinite loop. */ Tcl_Obj *boolObj; - DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -3976,8 +3976,8 @@ CompileUnaryOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -4018,8 +4018,8 @@ CompileAssociativeBinaryOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ @@ -4103,8 +4103,8 @@ CompileComparisonOpCmd( int instruction, CompileEnv *envPtr) { - Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { @@ -4265,15 +4265,15 @@ TclCompilePowOpCmd( * compiled. */ CompileEnv *envPtr) { + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; + int words; + /* * This one has its own implementation because the ** operator is the only * one with right associativity. */ - Tcl_Token *tokenPtr = parsePtr->tokenPtr; - DefineLineInformation; /* TIP #280 */ - int words; - for (words=1 ; words<parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); @@ -4440,8 +4440,8 @@ TclCompileMinusOpCmd( * compiled. */ CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ @@ -4486,8 +4486,8 @@ TclCompileDivOpCmd( * compiled. */ CompileEnv *envPtr) { - Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; int words; /* TODO: Consider support for compiling expanded args. */ diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 41c81af..ece0cae 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -968,9 +968,9 @@ DupByteCodeInternalRep( static void FreeByteCodeInternalRep( - register Tcl_Obj *objPtr) /* Object whose internal rep to free. */ + Tcl_Obj *objPtr) /* Object whose internal rep to free. */ { - register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1; + ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1; objPtr->typePtr = NULL; if (codePtr->refCount-- <= 1) { @@ -999,14 +999,14 @@ FreeByteCodeInternalRep( void TclCleanupByteCode( - register ByteCode *codePtr) /* Points to the ByteCode to free. */ + ByteCode *codePtr) /* Points to the ByteCode to free. */ { Tcl_Interp *interp = (Tcl_Interp *) *codePtr->interpHandle; Interp *iPtr = (Interp *) interp; int numLitObjects = codePtr->numLitObjects; int numAuxDataItems = codePtr->numAuxDataItems; - register Tcl_Obj **objArrayPtr, *objPtr; - register const AuxData *auxDataPtr; + Tcl_Obj **objArrayPtr, *objPtr; + const AuxData *auxDataPtr; int i; #ifdef TCL_COMPILE_STATS @@ -1354,9 +1354,9 @@ CompileSubstObj( static void FreeSubstCodeInternalRep( - register Tcl_Obj *objPtr) /* Object whose internal rep to free. */ + Tcl_Obj *objPtr) /* Object whose internal rep to free. */ { - register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1; + ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1; objPtr->typePtr = NULL; if (codePtr->refCount-- <= 1) { @@ -1405,7 +1405,7 @@ void TclInitCompileEnv( Tcl_Interp *interp, /* The interpreter for which a CompileEnv * structure is initialized. */ - register CompileEnv *envPtr,/* Points to the CompileEnv structure to + CompileEnv *envPtr,/* Points to the CompileEnv structure to * initialize. */ const char *stringPtr, /* The source string to be compiled. */ int numBytes, /* Number of bytes in source string. */ @@ -1612,7 +1612,7 @@ TclInitCompileEnv( void TclFreeCompileEnv( - register CompileEnv *envPtr)/* Points to the CompileEnv structure. */ + CompileEnv *envPtr)/* Points to the CompileEnv structure. */ { if (envPtr->localLitTable.buckets != envPtr->localLitTable.staticBuckets){ ckfree(envPtr->localLitTable.buckets); @@ -1812,8 +1812,8 @@ TclCompileInvocation( int numWords, CompileEnv *envPtr) { - int wordIdx = 0, depth = TclGetStackDepth(envPtr); DefineLineInformation; + int wordIdx = 0, depth = TclGetStackDepth(envPtr); if (cmdObj) { CompileCmdLiteral(interp, cmdObj, envPtr); @@ -1856,8 +1856,8 @@ CompileExpanded( int numWords, CompileEnv *envPtr) { - int wordIdx = 0; DefineLineInformation; + int wordIdx = 0; int depth = TclGetStackDepth(envPtr); StartExpanding(envPtr); @@ -1915,8 +1915,8 @@ CompileCmdCompileProc( Command *cmdPtr, CompileEnv *envPtr) { - int unwind = 0, incrOffset = -1; DefineLineInformation; + int unwind = 0, incrOffset = -1; int depth = TclGetStackDepth(envPtr); /* @@ -2749,13 +2749,13 @@ TclInitByteCodeObj( Tcl_Obj *objPtr, /* Points object that should be initialized, * and whose string rep contains the source * code. */ - register CompileEnv *envPtr)/* Points to the CompileEnv structure from + CompileEnv *envPtr)/* Points to the CompileEnv structure from * which to create a ByteCode structure. */ { - register ByteCode *codePtr; + ByteCode *codePtr; size_t codeBytes, objArrayBytes, exceptArrayBytes, cmdLocBytes; size_t auxDataArrayBytes, structureSize; - register unsigned char *p; + unsigned char *p; #ifdef TCL_COMPILE_DEBUG unsigned char *nextPtr; #endif @@ -2940,7 +2940,7 @@ TclInitByteCodeObj( int TclFindCompiledLocal( - register const char *name, /* Points to first character of the name of a + const char *name, /* Points to first character of the name of a * scalar or array variable. If NULL, a * temporary var should be created. */ int nameBytes, /* Number of bytes in the name. */ @@ -2948,9 +2948,9 @@ TclFindCompiledLocal( * variable if it is new. */ CompileEnv *envPtr) /* Points to the current compile environment*/ { - register CompiledLocal *localPtr; + CompiledLocal *localPtr; int localVar = -1; - register int i; + int i; Proc *procPtr; /* @@ -3322,11 +3322,11 @@ EnterCmdWordData( int TclCreateExceptRange( ExceptionRangeType type, /* The kind of ExceptionRange desired. */ - register CompileEnv *envPtr)/* Points to CompileEnv for which to create a + CompileEnv *envPtr)/* Points to CompileEnv for which to create a * new ExceptionRange structure. */ { - register ExceptionRange *rangePtr; - register ExceptionAux *auxPtr; + ExceptionRange *rangePtr; + ExceptionAux *auxPtr; int index = envPtr->exceptArrayNext; if (index >= envPtr->exceptArrayEnd) { @@ -3690,11 +3690,11 @@ TclCreateAuxData( * the new aux data record. */ const AuxDataType *typePtr, /* Pointer to the type to attach to this * AuxData */ - register CompileEnv *envPtr)/* Points to the CompileEnv for which a new + CompileEnv *envPtr)/* Points to the CompileEnv for which a new * aux data structure is to be allocated. */ { int index; /* Index for the new AuxData structure. */ - register AuxData *auxDataPtr; + AuxData *auxDataPtr; /* Points to the new AuxData structure */ index = envPtr->auxDataArrayNext; @@ -3753,7 +3753,7 @@ TclCreateAuxData( void TclInitJumpFixupArray( - register JumpFixupArray *fixupArrayPtr) + JumpFixupArray *fixupArrayPtr) /* Points to the JumpFixupArray structure to * initialize. */ { @@ -3785,7 +3785,7 @@ TclInitJumpFixupArray( void TclExpandJumpFixupArray( - register JumpFixupArray *fixupArrayPtr) + JumpFixupArray *fixupArrayPtr) /* Points to the JumpFixupArray structure to * enlarge. */ { @@ -3834,7 +3834,7 @@ TclExpandJumpFixupArray( void TclFreeJumpFixupArray( - register JumpFixupArray *fixupArrayPtr) + JumpFixupArray *fixupArrayPtr) /* Points to the JumpFixupArray structure to * free. */ { @@ -4281,7 +4281,7 @@ GetCmdLocEncodingSize( * containing the CmdLocation structure to * encode. */ { - register CmdLocation *mapPtr = envPtr->cmdMapPtr; + CmdLocation *mapPtr = envPtr->cmdMapPtr; int numCmds = envPtr->numCommands; int codeDelta, codeLen, srcDelta, srcLen; int codeDeltaNext, codeLengthNext, srcDeltaNext, srcLengthNext; @@ -4365,11 +4365,11 @@ EncodeCmdLocMap( * memory block where the location information * is to be stored. */ { - register CmdLocation *mapPtr = envPtr->cmdMapPtr; + CmdLocation *mapPtr = envPtr->cmdMapPtr; int numCmds = envPtr->numCommands; - register unsigned char *p = startPtr; + unsigned char *p = startPtr; int codeDelta, codeLen, srcDelta, srcLen, prevOffset; - register int i; + int i; /* * Encode the code offset for each command as a sequence of deltas. @@ -4483,7 +4483,7 @@ RecordByteCodeStats( * to add to accumulated statistics. */ { Interp *iPtr = (Interp *) *codePtr->interpHandle; - register ByteCodeStats *statsPtr; + ByteCodeStats *statsPtr; if (iPtr == NULL) { /* Avoid segfaulting in case we're called in a deleted interp */ diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 03bbf03..ea32e8a 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -107,7 +107,7 @@ static inline Tcl_Obj * NewNsObj( Tcl_Namespace *namespacePtr) { - register Namespace *nsPtr = (Namespace *) namespacePtr; + Namespace *nsPtr = (Namespace *) namespacePtr; if (namespacePtr == TclGetGlobalNamespace(nsPtr->interp)) { return Tcl_NewStringObj("::", 2); @@ -1805,7 +1805,7 @@ NsEnsembleImplementationCmdNR( subcmdName = Tcl_GetStringFromObj(subObj, &stringLength); for (i=0 ; i<tableLength ; i++) { - register int cmp = strncmp(subcmdName, + int cmp = strncmp(subcmdName, ensemblePtr->subcommandArrayPtr[i], (unsigned) stringLength); @@ -2396,7 +2396,7 @@ MakeCachedEnsembleCommand( Tcl_HashEntry *hPtr, Tcl_Obj *fix) { - register EnsembleCmdRep *ensembleCmd; + EnsembleCmdRep *ensembleCmd; if (objPtr->typePtr == &ensembleCmdType) { ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1; @@ -2892,6 +2892,7 @@ TclCompileEnsemble( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); Tcl_Obj *mapObj, *subcmdObj, *targetCmdObj, *listObj, **elems; Tcl_Obj *replaced = Tcl_NewObj(), *replacement; @@ -2901,7 +2902,6 @@ TclCompileEnsemble( int ourResult = TCL_ERROR; unsigned numBytes; const char *word; - DefineLineInformation; Tcl_IncrRefCount(replaced); if (parsePtr->numWords < depth + 1) { @@ -3230,6 +3230,7 @@ TclAttemptCompileProc( Command *cmdPtr, CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; int result, i; Tcl_Token *saveTokenPtr = parsePtr->tokenPtr; int savedStackDepth = envPtr->currStackDepth; @@ -3239,7 +3240,6 @@ TclAttemptCompileProc( #ifdef TCL_COMPILE_DEBUG int savedExceptDepth = envPtr->exceptDepth; #endif - DefineLineInformation; if (cmdPtr->compileProc == NULL) { return TCL_ERROR; @@ -3363,11 +3363,11 @@ CompileToInvokedCommand( Command *cmdPtr, CompileEnv *envPtr) /* Holds resulting instructions. */ { + DefineLineInformation; Tcl_Token *tokPtr; Tcl_Obj *objPtr, **words; char *bytes; int length, i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME; - DefineLineInformation; /* * Push the words of the command. Take care; the command words may be diff --git a/generic/tclInt.h b/generic/tclInt.h index 7fc06c8..b59d312 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4484,9 +4484,6 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, (UCHAR(*((src) - 1))) < 0x80 ? (src)-1 : \ Tcl_UtfPrev(src, start)) -#define TclUtfNext(src) \ - (((UCHAR(*(src))) < 0x80) ? (src) + 1 : Tcl_UtfNext(src)) - /* *---------------------------------------------------------------- * Macro that encapsulates the logic that determines when it is safe to diff --git a/generic/tclProc.c b/generic/tclProc.c index f050d54..4600382 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -122,7 +122,7 @@ Tcl_ProcObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Interp *iPtr = (Interp *) interp; + Interp *iPtr = (Interp *) interp; Proc *procPtr; const char *procName; const char *simpleName, *procArgs, *procBody; @@ -197,9 +197,10 @@ Tcl_ProcObjCmd( */ if (iPtr->cmdFramePtr) { - CmdFrame *contextPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *contextPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *contextPtr = *iPtr->cmdFramePtr; + if (contextPtr->type == TCL_LOCATION_BC) { /* * Retrieve source information from the bytecode, if possible. If @@ -228,11 +229,11 @@ Tcl_ProcObjCmd( && (contextPtr->nline >= 4) && (contextPtr->line[3] >= 0)) { int isNew; Tcl_HashEntry *hePtr; - CmdFrame *cfPtr = ckalloc(sizeof(CmdFrame)); + CmdFrame *cfPtr = (CmdFrame *)ckalloc(sizeof(CmdFrame)); cfPtr->level = -1; cfPtr->type = contextPtr->type; - cfPtr->line = ckalloc(sizeof(int)); + cfPtr->line = (int *)ckalloc(sizeof(int)); cfPtr->line[0] = contextPtr->line[3]; cfPtr->nline = 1; cfPtr->framePtr = NULL; @@ -245,7 +246,7 @@ Tcl_ProcObjCmd( cfPtr->len = 0; hePtr = Tcl_CreateHashEntry(iPtr->linePBodyPtr, - procPtr, &isNew); + (char *)procPtr, &isNew); if (!isNew) { /* * Get the old command frame and release it. See also @@ -370,9 +371,9 @@ TclCreateProc( { Interp *iPtr = (Interp *) interp; - register Proc *procPtr; + Proc *procPtr; int i, result, numArgs; - register CompiledLocal *localPtr = NULL; + CompiledLocal *localPtr = NULL; Tcl_Obj **argArray; int precompiled = 0; @@ -434,7 +435,7 @@ TclCreateProc( Tcl_IncrRefCount(bodyPtr); - procPtr = ckalloc(sizeof(Proc)); + procPtr = (Proc *)ckalloc(sizeof(Proc)); procPtr->iPtr = iPtr; procPtr->refCount = 1; procPtr->bodyPtr = bodyPtr; @@ -451,7 +452,7 @@ TclCreateProc( * in the Proc. */ - result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray); + result = Tcl_ListObjGetElements(interp, argsPtr, &numArgs, &argArray); if (result != TCL_OK) { goto procError; } @@ -473,7 +474,7 @@ TclCreateProc( } for (i = 0; i < numArgs; i++) { - const char *argname, *argnamei, *argnamelast; + const char *argname, *p, *last; int fieldCount, nameLength; Tcl_Obj **fieldValues; @@ -504,17 +505,15 @@ TclCreateProc( goto procError; } - argname = Tcl_GetStringFromObj(fieldValues[0], &nameLength); - /* * Check that the formal parameter name is a scalar. */ - argnamei = argname; - argnamelast = Tcl_UtfPrev(argname + nameLength, argname); - while (argnamei < argnamelast) { - if (*argnamei == '(') { - if (*argnamelast == ')') { /* We have an array element. */ + p = argname = Tcl_GetStringFromObj(fieldValues[0], &nameLength); + last = argname + nameLength; + while (p < last) { + if (*p == '(') { + if (last[-1] == ')') { /* We have an array element. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "formal parameter \"%s\" is an array element", Tcl_GetString(fieldValues[0]))); @@ -522,7 +521,7 @@ TclCreateProc( "FORMALARGUMENTFORMAT", NULL); goto procError; } - } else if (*argnamei == ':' && *(argnamei+1) == ':') { + } else if (p[0] == ':' && p[1] == ':') { Tcl_Obj *errorObj = Tcl_NewStringObj( "formal parameter \"", -1); Tcl_AppendObjToObj(errorObj, fieldValues[0]); @@ -532,7 +531,7 @@ TclCreateProc( "FORMALARGUMENTFORMAT", NULL); goto procError; } - argnamei = Tcl_UtfNext(argnamei); + p++; } if (precompiled) { @@ -600,7 +599,8 @@ TclCreateProc( * local variables for the argument. */ - localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); + localPtr = (CompiledLocal *)ckalloc( + TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -684,7 +684,7 @@ TclGetFrame( CallFrame **framePtrPtr) /* Store pointer to frame here (or NULL if * global frame indicated). */ { - register Interp *iPtr = (Interp *) interp; + Interp *iPtr = (Interp *) interp; int curLevel, level, result; CallFrame *framePtr; @@ -768,7 +768,7 @@ TclObjGetFrame( CallFrame **framePtrPtr) /* Store pointer to frame here (or NULL if * global frame indicated). */ { - register Interp *iPtr = (Interp *) interp; + Interp *iPtr = (Interp *) interp; int curLevel, level, result; const char *name = NULL; @@ -895,7 +895,7 @@ TclNRUplevelObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { - register Interp *iPtr = (Interp *) interp; + Interp *iPtr = (Interp *) interp; CmdFrame *invoker = NULL; int word = 0; int result; @@ -1035,7 +1035,7 @@ ProcWrongNumArgs( int skip) { CallFrame *framePtr = ((Interp *)interp)->varFramePtr; - register Proc *procPtr = framePtr->procPtr; + Proc *procPtr = framePtr->procPtr; int localCt = procPtr->numCompiledLocals, numArgs, i; Tcl_Obj **desiredObjs; const char *final = NULL; @@ -1045,7 +1045,7 @@ ProcWrongNumArgs( */ numArgs = framePtr->procPtr->numArgs; - desiredObjs = TclStackAlloc(interp, + desiredObjs = (Tcl_Obj **)TclStackAlloc(interp, (int) sizeof(Tcl_Obj *) * (numArgs+1)); if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { @@ -1060,7 +1060,7 @@ ProcWrongNumArgs( Tcl_IncrRefCount(desiredObjs[0]); if (localCt > 0) { - register Var *defPtr = (Var *) (&framePtr->localCachePtr->varName0 + localCt); + Var *defPtr = (Var *)(&framePtr->localCachePtr->varName0 + localCt); for (i=1 ; i<=numArgs ; i++, defPtr++) { Tcl_Obj *argObj; @@ -1251,7 +1251,7 @@ InitResolvedLocals( resVarInfo = localPtr->resolveInfo; if (resVarInfo && resVarInfo->fetchProc) { - register Var *resolvedVarPtr = (Var *) + Var *resolvedVarPtr = (Var *) resVarInfo->fetchProc(interp, resVarInfo); if (resolvedVarPtr) { @@ -1274,7 +1274,7 @@ TclFreeLocalCache( Tcl_Obj **namePtrPtr = &localCachePtr->varName0; for (i = 0; i < localCachePtr->numVars; i++, namePtrPtr++) { - register Tcl_Obj *objPtr = *namePtrPtr; + Tcl_Obj *objPtr = *namePtrPtr; if (objPtr) { /* TclReleaseLiteral calls Tcl_DecrRefCount for us */ @@ -1358,16 +1358,16 @@ InitLocalCache( static int InitArgsAndLocals( - register Tcl_Interp *interp,/* Interpreter in which procedure was + Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ Tcl_Obj *procNameObj, /* Procedure name for error reporting. */ int skip) /* Number of initial arguments to be skipped, * i.e., words in the "command name". */ { CallFrame *framePtr = ((Interp *)interp)->varFramePtr; - register Proc *procPtr = framePtr->procPtr; + Proc *procPtr = framePtr->procPtr; ByteCode *codePtr = procPtr->bodyPtr->internalRep.twoPtrValue.ptr1; - register Var *varPtr, *defPtr; + Var *varPtr, *defPtr; int localCt = procPtr->numCompiledLocals, numArgs, argCt, i, imax; Tcl_Obj *const *argObjs; @@ -1393,7 +1393,7 @@ InitArgsAndLocals( * parameters. */ - varPtr = TclStackAlloc(interp, (int)(localCt * sizeof(Var))); + varPtr = TclStackAlloc(interp, localCt * sizeof(Var)); framePtr->compiledLocals = varPtr; framePtr->numCompiledLocals = localCt; @@ -1523,7 +1523,7 @@ int TclPushProcCallFrame( ClientData clientData, /* Record describing procedure to be * interpreted. */ - register Tcl_Interp *interp,/* Interpreter in which procedure was + Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ int objc, /* Count of number of arguments to this * procedure. */ @@ -1615,7 +1615,7 @@ int TclObjInterpProc( ClientData clientData, /* Record describing procedure to be * interpreted. */ - register Tcl_Interp *interp,/* Interpreter in which procedure was + Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ int objc, /* Count of number of arguments to this * procedure. */ @@ -1632,7 +1632,7 @@ int TclNRInterpProc( ClientData clientData, /* Record describing procedure to be * interpreted. */ - register Tcl_Interp *interp,/* Interpreter in which procedure was + Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ int objc, /* Count of number of arguments to this * procedure. */ @@ -1667,7 +1667,7 @@ TclNRInterpProc( int TclNRInterpProcCore( - register Tcl_Interp *interp,/* Interpreter in which procedure was + Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ Tcl_Obj *procNameObj, /* Procedure name for error reporting. */ int skip, /* Number of initial arguments to be skipped, @@ -1676,7 +1676,7 @@ TclNRInterpProcCore( * results of the overall procedure. */ { Interp *iPtr = (Interp *) interp; - register Proc *procPtr = iPtr->varFramePtr->procPtr; + Proc *procPtr = iPtr->varFramePtr->procPtr; int result; CallFrame *freePtr; ByteCode *codePtr; @@ -1693,8 +1693,8 @@ TclNRInterpProcCore( #if defined(TCL_COMPILE_DEBUG) if (tclTraceExec >= 1) { - register CallFrame *framePtr = iPtr->varFramePtr; - register int i; + CallFrame *framePtr = iPtr->varFramePtr; + int i; if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { fprintf(stdout, "Calling lambda "); @@ -2107,9 +2107,9 @@ TclProcDeleteProc( void TclProcCleanupProc( - register Proc *procPtr) /* Procedure to be deleted. */ + Proc *procPtr) /* Procedure to be deleted. */ { - register CompiledLocal *localPtr; + CompiledLocal *localPtr; Tcl_Obj *bodyPtr = procPtr->bodyPtr; Tcl_Obj *defPtr; Tcl_ResolvedVarInfo *resVarInfo; @@ -2156,7 +2156,7 @@ TclProcCleanupProc( return; } - cfPtr = Tcl_GetHashValue(hePtr); + cfPtr = (CmdFrame *) Tcl_GetHashValue(hePtr); if (cfPtr) { if (cfPtr->type == TCL_LOCATION_SOURCE) { @@ -2360,7 +2360,7 @@ ProcBodyFree( static void DupLambdaInternalRep( Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + Tcl_Obj *copyPtr) /* Object with internal rep to set. */ { Proc *procPtr = srcPtr->internalRep.twoPtrValue.ptr1; Tcl_Obj *nsObjPtr = srcPtr->internalRep.twoPtrValue.ptr2; @@ -2375,7 +2375,7 @@ DupLambdaInternalRep( static void FreeLambdaInternalRep( - register Tcl_Obj *objPtr) /* CmdName object with internal representation + Tcl_Obj *objPtr) /* CmdName object with internal representation * to free. */ { Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1; @@ -2391,7 +2391,7 @@ FreeLambdaInternalRep( static int SetLambdaFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ + Tcl_Obj *objPtr) /* The object to convert. */ { Interp *iPtr = (Interp *) interp; const char *name; diff --git a/generic/tclTest.c b/generic/tclTest.c index 5f7de16..37aafd2 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6761,10 +6761,10 @@ TestUtfNextCmd( return TCL_OK; } - first = result = TclUtfNext(buffer + 1); + first = result = Tcl_UtfNext(buffer + 1); while ((buffer[0] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */ - result = TclUtfNext(buffer + 1); + result = Tcl_UtfNext(buffer + 1); if (first != result) { Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL); return TCL_ERROR; @@ -6773,7 +6773,7 @@ TestUtfNextCmd( p = tobetested; while ((buffer[numBytes + 1] = *p++) != '\0') { /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ - result = TclUtfNext(buffer + 1); + result = Tcl_UtfNext(buffer + 1); if (first != result) { first = buffer; break; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b4a07bb..a9819d5 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1853,8 +1853,9 @@ TclTrim( /* If we did not trim the whole string, it starts with a character * that we will not trim. Skip over it. */ if (numBytes > 0) { + int ch; const char *first = bytes + trimLeft; - bytes = TclUtfNext(first); + bytes += TclUtfToUCS4(first, &ch); numBytes -= (bytes - first); if (numBytes > 0) { @@ -3713,10 +3714,10 @@ TclGetIntForIndex( static void UpdateStringOfEndOffset( - register Tcl_Obj *objPtr) + Tcl_Obj *objPtr) { char buffer[TCL_INTEGER_SPACE + 5]; - register int len = 3; + int len = 3; memcpy(buffer, "end", 4); if (objPtr->internalRep.longValue != 0) { @@ -3787,7 +3788,7 @@ SetEndOffsetFromAny( Tcl_Obj *objPtr) /* Pointer to the object to parse */ { int offset; /* Offset in the "end-offset" expression */ - register const char *bytes; /* String rep of the object */ + const char *bytes; /* String rep of the object */ int length; /* Length of the object's string rep */ /* |
