summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-28 10:39:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-28 10:39:50 (GMT)
commit947369a720dc58ad94435918a85bee712448a48e (patch)
tree130e81956048945337c1a55693832518e2897ed7 /generic
parent94a0658bc2c711a2e464dfc5a7dc3fd0b233fa82 (diff)
parentf6bf85fb67eb15e637ecf7c7de4f661dc0557b43 (diff)
downloadtcl-947369a720dc58ad94435918a85bee712448a48e.zip
tcl-947369a720dc58ad94435918a85bee712448a48e.tar.gz
tcl-947369a720dc58ad94435918a85bee712448a48e.tar.bz2
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmdsGR.c2
-rw-r--r--generic/tclCompExpr.c14
-rw-r--r--generic/tclExecute.c6
-rw-r--r--generic/tclIOUtil.c2
-rw-r--r--generic/tclPkg.c2
-rw-r--r--generic/tclResult.c8
-rw-r--r--generic/tclScan.c8
-rw-r--r--generic/tclStringObj.c34
-rw-r--r--generic/tclTest.c6
-rw-r--r--generic/tclTrace.c3
-rw-r--r--generic/tclUtil.c4
-rw-r--r--generic/tclVar.c62
12 files changed, 72 insertions, 79 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 221ac3a..780f7b8 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -874,7 +874,7 @@ TclCompileLappendCmd(
*/
if (numWords > 2) {
- Tcl_Token *valueTokenPtr = TokenAfter(varTokenPtr);
+ valueTokenPtr = TokenAfter(varTokenPtr);
CompileWord(envPtr, valueTokenPtr, interp, 2);
}
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 476ff14..2f3fecb 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2463,7 +2463,7 @@ CompileExprTree(
if (optimize) {
int length;
const char *bytes = TclGetStringFromObj(literal, &length);
- int index = TclRegisterLiteral(envPtr, bytes, length, 0);
+ int idx = TclRegisterLiteral(envPtr, bytes, length, 0);
Tcl_Obj *objPtr = TclFetchLiteral(envPtr, index);
if ((objPtr->typePtr == NULL) && (literal->typePtr != NULL)) {
@@ -2484,7 +2484,7 @@ CompileExprTree(
objPtr->internalRep = literal->internalRep;
literal->typePtr = NULL;
}
- TclEmitPush(index, envPtr);
+ TclEmitPush(idx, envPtr);
} else {
/*
* When optimize==0, we know the expression is a one-off and
@@ -2510,7 +2510,7 @@ CompileExprTree(
if (ExecConstantExprTree(interp, nodes, next, litObjvPtr)
== TCL_OK) {
- int index;
+ int idx;
Tcl_Obj *objPtr = Tcl_GetObjResult(interp);
/*
@@ -2524,8 +2524,8 @@ CompileExprTree(
const char *bytes
= Tcl_GetStringFromObj(objPtr, &numBytes);
- index = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
- tableValue = TclFetchLiteral(envPtr, index);
+ idx = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
+ tableValue = TclFetchLiteral(envPtr, idx);
if ((tableValue->typePtr == NULL) &&
(objPtr->typePtr != NULL)) {
/*
@@ -2537,9 +2537,9 @@ CompileExprTree(
objPtr->typePtr = NULL;
}
} else {
- index = TclAddLiteralObj(envPtr, objPtr, NULL);
+ idx = TclAddLiteralObj(envPtr, objPtr, NULL);
}
- TclEmitPush(index, envPtr);
+ TclEmitPush(idx, envPtr);
} else {
TclCompileSyntaxError(interp, envPtr);
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 13f328c..867cdd7 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -6427,8 +6427,8 @@ TEBCresume(
if (TclHasIntRep(valuePtr, &tclBooleanType)) {
objResultPtr = TCONST(1);
} else {
- int result = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
- objResultPtr = TCONST(result);
+ int res = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
+ objResultPtr = TCONST(res);
}
TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr);
NEXT_INST_F(1, 0, 1);
@@ -6622,7 +6622,7 @@ TEBCresume(
}
{
ForeachInfo *infoPtr;
- Tcl_Obj *listPtr, **elements, *tmpPtr;
+ Tcl_Obj *listPtr, **elements;
ForeachVarList *varListPtr;
int numLists, listLen, numVars;
int listTmpDepth;
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index c413b21..3591431 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -3173,7 +3173,7 @@ Tcl_LoadFile(
}
if (fsPtr->loadFileProc != NULL) {
- int retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc))
+ retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc))
(interp, pathPtr, handlePtr, &unloadProcPtr, flags);
if (retVal == TCL_OK) {
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index b55ad3e..cda74b1 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -1368,9 +1368,9 @@ TclNRPackageObjCmd(
newObjvPtr, NULL);
return TCL_OK;
} else {
- int i, newobjc = objc-3;
Tcl_Obj *const *newobjv = objv + 3;
+ newobjc = objc - 3;
if (CheckAllRequirements(interp, objc-3, objv+3) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 4b9df6c..1fb2ad0 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -841,19 +841,19 @@ SetupAppendBuffer(
totalSpace = newSpace + iPtr->appendUsed;
if (totalSpace >= iPtr->appendAvl) {
- char *newSpace;
+ char *newSpacePtr;
if (totalSpace < 100) {
totalSpace = 200;
} else {
totalSpace *= 2;
}
- newSpace = (char *)ckalloc(totalSpace);
- strcpy(newSpace, iPtr->result);
+ newSpacePtr = (char *)ckalloc(totalSpace);
+ strcpy(newSpacePtr, iPtr->result);
if (iPtr->appendResult != NULL) {
ckfree(iPtr->appendResult);
}
- iPtr->appendResult = newSpace;
+ iPtr->appendResult = newSpacePtr;
iPtr->appendAvl = totalSpace;
} else if (iPtr->result != iPtr->appendResult) {
strcpy(iPtr->appendResult, iPtr->result);
diff --git a/generic/tclScan.c b/generic/tclScan.c
index dfd6b88..1eefafe 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -937,16 +937,16 @@ Tcl_ScanObjCmd(
} else if (flags & SCAN_BIG) {
if (flags & SCAN_UNSIGNED) {
mp_int big;
- int code = Tcl_GetBignumFromObj(interp, objPtr, &big);
+ int res = Tcl_GetBignumFromObj(interp, objPtr, &big);
- if (code == TCL_OK) {
+ if (res == TCL_OK) {
if (mp_isneg(&big)) {
- code = TCL_ERROR;
+ res = TCL_ERROR;
}
mp_clear(&big);
}
- if (code == TCL_ERROR) {
+ if (res == TCL_ERROR) {
if (objs != NULL) {
ckfree(objs);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 7486631..66647f0 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2443,10 +2443,10 @@ Tcl_AppendFormatToObj(
goto errorMsg;
}
if (ch == 'A') {
- char *p = TclGetString(segment) + 1;
- *p = 'x';
- p = strchr(p, 'P');
- if (p) *p = 'p';
+ char *q = TclGetString(segment) + 1;
+ *q = 'x';
+ q = strchr(q, 'P');
+ if (q) *q = 'p';
}
break;
}
@@ -3561,7 +3561,7 @@ TclStringFirst(
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
- Tcl_UniChar *check, *end, *uh, *un;
+ Tcl_UniChar *checkStr, *endStr, *uh, *un;
if (start < 0) {
start = 0;
@@ -3627,12 +3627,12 @@ TclStringFirst(
/* Don't start the loop if there cannot be a valid answer */
goto firstEnd;
}
- end = uh + lh;
+ endStr = uh + lh;
- for (check = uh + start; check + ln <= end; check++) {
- if ((*check == *un) && (0 ==
- memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
- value = (check - uh);
+ for (checkStr = uh + start; checkStr + ln <= endStr; checkStr++) {
+ if ((*checkStr == *un) && (0 ==
+ memcmp(checkStr + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
+ value = (checkStr - uh);
goto firstEnd;
}
}
@@ -3668,7 +3668,7 @@ TclStringLast(
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
- Tcl_UniChar *check, *uh, *un;
+ Tcl_UniChar *checkStr, *uh, *un;
if (ln == 0) {
/*
@@ -3714,14 +3714,14 @@ TclStringLast(
/* Don't start the loop if there cannot be a valid answer */
goto lastEnd;
}
- check = uh + last + 1 - ln;
- while (check >= uh) {
- if ((*check == un[0])
- && (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
- value = (check - uh);
+ checkStr = uh + last + 1 - ln;
+ while (checkStr >= uh) {
+ if ((*checkStr == un[0])
+ && (0 == memcmp(checkStr+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
+ value = (checkStr - uh);
goto lastEnd;
}
- check--;
+ checkStr--;
}
lastEnd:
TclNewIntObj(result, value);
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 5ebbfdd..1523666 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -7488,8 +7488,6 @@ TestconcatobjCmd(
"\n\t* (e) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (e) concatObj is not a new obj ",
NULL);
@@ -7520,8 +7518,6 @@ TestconcatobjCmd(
"\n\t* (f) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (f) concatObj is not a new obj ",
NULL);
@@ -7553,8 +7549,6 @@ TestconcatobjCmd(
"\n\t* (g) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (g) concatObj is not a new obj ",
NULL);
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 1b59852..cf9da4f 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -1177,7 +1177,7 @@ Tcl_UntraceCommand(
CommandTrace *tracePtr;
CommandTrace *prevPtr;
Command *cmdPtr;
- Interp *iPtr = (Interp *) interp;
+ Interp *iPtr = (Interp *)interp;
ActiveCommandTrace *activePtr;
int hasExecTraces = 0;
@@ -1252,7 +1252,6 @@ Tcl_UntraceCommand(
*/
if (cmdPtr->compileProc != NULL) {
- Interp *iPtr = (Interp *) interp;
iPtr->compileEpoch++;
}
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index f6d815b..170a85e 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3757,7 +3757,7 @@ GetEndOffsetFromObj(
if (*bytes != 'e') {
int numType;
const char *opPtr;
- int length, t1 = 0, t2 = 0;
+ int t1 = 0, t2 = 0;
/* Value doesn't start with "e" */
@@ -3774,7 +3774,7 @@ GetEndOffsetFromObj(
* Quick scan to see if multi-value list is even possible.
* This relies on TclGetString() returning a NUL-terminated string.
*/
- if ((TclMaxListLength(TclGetString(objPtr), -1, NULL) > 1)
+ if ((TclMaxListLength(bytes, -1, NULL) > 1)
/* If it's possible, do the full list parse. */
&& (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length))
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 3d46790..a48cf96 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -119,17 +119,17 @@ VarHashNextVar(
* access is denied.
*/
-static const char *noSuchVar = "no such variable";
-static const char *isArray = "variable is array";
-static const char *needArray = "variable isn't array";
-static const char *noSuchElement = "no such element in array";
-static const char *danglingElement =
+static const char NOSUCHVAR[] = "no such variable";
+static const char ISARRAY[] = "variable is array";
+static const char NEEDARRAY[] = "variable isn't array";
+static const char NOSUCHELEMENT[] = "no such element in array";
+static const char DANGLINGELEMENT[] =
"upvar refers to element in deleted array";
-static const char *danglingVar =
+static const char DANGLINGVAR[] =
"upvar refers to variable in deleted namespace";
-static const char *badNamespace = "parent namespace doesn't exist";
-static const char *missingName = "missing variable name";
-static const char *isArrayElement =
+static const char BADNAMESPACE[] = "parent namespace doesn't exist";
+static const char MISSINGNAME[] = "missing variable name";
+static const char ISARRAYELEMENT[] =
"name refers to an element in an array";
/*
@@ -649,7 +649,7 @@ TclObjLookupVarEx(
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
- noSuchVar, -1);
+ NOSUCHVAR, -1);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VARNAME", NULL);
}
return NULL;
@@ -674,7 +674,7 @@ TclObjLookupVarEx(
if (part2Ptr != NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VARNAME",
NULL);
}
@@ -939,7 +939,7 @@ TclLookupSimpleVar(
Tcl_Obj *tailPtr;
if (!create) { /* Var wasn't found and not to create it. */
- *errMsgPtr = noSuchVar;
+ *errMsgPtr = NOSUCHVAR;
return NULL;
}
@@ -950,10 +950,10 @@ TclLookupSimpleVar(
TclGetNamespaceForQualName(interp, varName, cxtNsPtr, flags,
&varNsPtr, &dummy1Ptr, &dummy2Ptr, &tail);
if (varNsPtr == NULL) {
- *errMsgPtr = badNamespace;
+ *errMsgPtr = BADNAMESPACE;
return NULL;
} else if (tail == NULL) {
- *errMsgPtr = missingName;
+ *errMsgPtr = MISSINGNAME;
return NULL;
}
if (tail != varName) {
@@ -1010,7 +1010,7 @@ TclLookupSimpleVar(
varPtr = VarHashFindVar(tablePtr, varNamePtr);
}
if (varPtr == NULL) {
- *errMsgPtr = noSuchVar;
+ *errMsgPtr = NOSUCHVAR;
}
}
}
@@ -1088,7 +1088,7 @@ TclLookupArrayElement(
if (!createArray) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- noSuchVar, index);
+ NOSUCHVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
}
@@ -1103,7 +1103,7 @@ TclLookupArrayElement(
if (TclIsVarDeadHash(arrayPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- danglingVar, index);
+ DANGLINGVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
}
@@ -1113,7 +1113,7 @@ TclLookupArrayElement(
TclInitArrayVar(arrayPtr);
} else if (!TclIsVarArray(arrayPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
- TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg, needArray,
+ TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg, NEEDARRAY,
index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
@@ -1135,7 +1135,7 @@ TclLookupArrayElement(
if (varPtr == NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- noSuchElement, index);
+ NOSUCHELEMENT, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ELEMENT",
TclGetString(elNamePtr), NULL);
}
@@ -1485,11 +1485,11 @@ TclPtrGetVarIdx(
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarUndefined(varPtr) && arrayPtr
&& !TclIsVarUndefined(arrayPtr)) {
- msg = noSuchElement;
+ msg = NOSUCHELEMENT;
} else if (TclIsVarArray(varPtr)) {
- msg = isArray;
+ msg = ISARRAY;
} else {
- msg = noSuchVar;
+ msg = NOSUCHVAR;
}
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "read", msg, index);
}
@@ -2024,11 +2024,11 @@ TclPtrSetVarIdx(
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarArrayElement(varPtr)) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set",
- danglingElement, index);
+ DANGLINGELEMENT, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ELEMENT", NULL);
} else {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set",
- danglingVar, index);
+ DANGLINGVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME", NULL);
}
}
@@ -2041,7 +2041,7 @@ TclPtrSetVarIdx(
if (TclIsVarArray(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
- TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set", isArray,index);
+ TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set", ISARRAY,index);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
}
goto earlyError;
@@ -2609,7 +2609,7 @@ TclPtrUnsetVarIdx(
if (result != TCL_OK) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "unset",
- ((arrayPtr == NULL) ? noSuchVar : noSuchElement), index);
+ ((arrayPtr == NULL) ? NOSUCHVAR : NOSUCHELEMENT), index);
Tcl_SetErrorCode(interp, "TCL", "UNSET", "VARNAME", NULL);
}
}
@@ -4104,7 +4104,7 @@ ArraySetCmd(
}
if (arrayPtr) {
CleanupVar(varPtr, arrayPtr);
- TclObjVarErrMsg(interp, arrayNameObj, NULL, "set", needArray, -1);
+ TclObjVarErrMsg(interp, arrayNameObj, NULL, "set", NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
TclGetString(arrayNameObj), NULL);
return TCL_ERROR;
@@ -4223,7 +4223,7 @@ ArraySetCmd(
*/
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
return TCL_ERROR;
}
@@ -5124,7 +5124,7 @@ Tcl_VariableObjCmd(
*/
TclObjVarErrMsg(interp, varNamePtr, NULL, "define",
- isArrayElement, -1);
+ ISARRAYELEMENT, -1);
Tcl_SetErrorCode(interp, "TCL", "UPVAR", "LOCAL_ELEMENT", NULL);
return TCL_ERROR;
}
@@ -6702,7 +6702,7 @@ ArrayDefaultCmd(
CleanupVar(varPtr, arrayPtr);
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
TclGetString(arrayNameObj), NULL);
return TCL_ERROR;
@@ -6713,7 +6713,7 @@ ArrayDefaultCmd(
*/
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
return TCL_ERROR;
}