diff options
-rw-r--r-- | generic/tclCompCmdsGR.c | 2 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 14 | ||||
-rw-r--r-- | generic/tclExecute.c | 6 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 2 | ||||
-rw-r--r-- | generic/tclPkg.c | 2 | ||||
-rw-r--r-- | generic/tclScan.c | 8 | ||||
-rw-r--r-- | generic/tclStringObj.c | 34 | ||||
-rw-r--r-- | generic/tclTest.c | 6 | ||||
-rw-r--r-- | generic/tclTrace.c | 3 | ||||
-rw-r--r-- | generic/tclUtil.c | 8 | ||||
-rw-r--r-- | generic/tclVar.c | 62 | ||||
-rw-r--r-- | win/tclWinFile.c | 4 | ||||
-rw-r--r-- | win/tclWinSerial.c | 14 |
13 files changed, 78 insertions, 87 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 1f04d02..9dda453 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -875,7 +875,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 dc10e4b..ed5794a 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2463,7 +2463,7 @@ CompileExprTree( if (optimize) { size_t 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 = TclGetStringFromObj(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 19bcc22..06c2dad 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -6218,8 +6218,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); @@ -6249,7 +6249,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 3d6c47e..144b8bd 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -3174,7 +3174,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 9681a52..1fc5ae1 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -1370,9 +1370,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/tclScan.c b/generic/tclScan.c index f018b14..d0fc5a7 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) { Tcl_Free(objs); } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 1471ce1..28b1726 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2339,10 +2339,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; } @@ -3455,7 +3455,7 @@ TclStringFirst( { size_t lh = 0, ln = Tcl_GetCharLength(needle); size_t value = TCL_INDEX_NONE; - Tcl_UniChar *check, *end, *uh, *un; + Tcl_UniChar *checkStr, *endStr, *uh, *un; Tcl_Obj *obj; if (start == TCL_INDEX_NONE) { @@ -3522,12 +3522,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; } } @@ -3562,7 +3562,7 @@ TclStringLast( { size_t lh = 0, ln = Tcl_GetCharLength(needle); size_t value = TCL_INDEX_NONE; - Tcl_UniChar *check, *uh, *un; + Tcl_UniChar *checkStr, *uh, *un; Tcl_Obj *obj; if (ln == 0) { @@ -3609,14 +3609,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: TclNewIndexObj(obj, value); diff --git a/generic/tclTest.c b/generic/tclTest.c index fcd14b5..e23d42d 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7490,8 +7490,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); @@ -7522,8 +7520,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); @@ -7555,8 +7551,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 0b1fe4e..16d5432 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1178,7 +1178,7 @@ Tcl_UntraceCommand( CommandTrace *tracePtr; CommandTrace *prevPtr; Command *cmdPtr; - Interp *iPtr = (Interp *) interp; + Interp *iPtr = (Interp *)interp; ActiveCommandTrace *activePtr; int hasExecTraces = 0; @@ -1253,7 +1253,6 @@ Tcl_UntraceCommand( */ if (cmdPtr->compileProc != NULL) { - Interp *iPtr = (Interp *) interp; iPtr->compileEpoch++; } } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index f4ccfc8..ac1cd35 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3457,7 +3457,7 @@ GetEndOffsetFromObj( if (*bytes != 'e') { int numType; const char *opPtr; - int length, t1 = 0, t2 = 0; + int len, t1 = 0, t2 = 0; /* Value doesn't start with "e" */ @@ -3474,11 +3474,11 @@ 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)) - && (length > 1)) { + && (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &len)) + && (len > 1)) { goto parseError; } diff --git a/generic/tclVar.c b/generic/tclVar.c index 8696bd0..8a779bd 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); } @@ -936,7 +936,7 @@ TclLookupSimpleVar( Tcl_Obj *tailPtr; if (!create) { /* Var wasn't found and not to create it. */ - *errMsgPtr = noSuchVar; + *errMsgPtr = NOSUCHVAR; return NULL; } @@ -947,10 +947,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) { @@ -1007,7 +1007,7 @@ TclLookupSimpleVar( varPtr = VarHashFindVar(tablePtr, varNamePtr); } if (varPtr == NULL) { - *errMsgPtr = noSuchVar; + *errMsgPtr = NOSUCHVAR; } } } @@ -1085,7 +1085,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); } @@ -1100,7 +1100,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); } @@ -1110,7 +1110,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); @@ -1132,7 +1132,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); } @@ -1437,11 +1437,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); } @@ -1929,11 +1929,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); } } @@ -1946,7 +1946,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; @@ -2463,7 +2463,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); } } @@ -3958,7 +3958,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; @@ -4077,7 +4077,7 @@ ArraySetCmd( */ TclObjVarErrMsg(interp, arrayNameObj, NULL, "array set", - needArray, -1); + NEEDARRAY, -1); Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL); return TCL_ERROR; } @@ -4921,7 +4921,7 @@ Tcl_VariableObjCmd( */ TclObjVarErrMsg(interp, varNamePtr, NULL, "define", - isArrayElement, -1); + ISARRAYELEMENT, -1); Tcl_SetErrorCode(interp, "TCL", "UPVAR", "LOCAL_ELEMENT", NULL); return TCL_ERROR; } @@ -6503,7 +6503,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; @@ -6514,7 +6514,7 @@ ArrayDefaultCmd( */ TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set", - needArray, -1); + NEEDARRAY, -1); Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL); return TCL_ERROR; } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 3977418..a35c6eb 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -1075,7 +1075,6 @@ TclpMatchInDirectory( do { const char *utfname; int checkDrive = 0, isDrive; - DWORD attr; native = data.cFileName; attr = data.dwFileAttributes; @@ -1426,7 +1425,6 @@ TclpGetUserHome( int rc = 0; const char *domain; WCHAR *wName, *wHomeDir, *wDomain; - WCHAR buf[MAX_PATH]; Tcl_DStringInit(bufferPtr); @@ -1492,6 +1490,7 @@ TclpGetUserHome( size = lstrlenW(wHomeDir); Tcl_WCharToUtfDString(wHomeDir, size, bufferPtr); } else { + WCHAR buf[MAX_PATH]; /* * User exists but has no home dir. Return * "{GetProfilesDirectory}/<user>". @@ -2798,7 +2797,6 @@ TclpObjNormalizePath( * Not the end of the string. */ - char *path; Tcl_Obj *tmpPathPtr; size_t length; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index d8106f4..aa87354 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1826,7 +1826,7 @@ SerialSetOptionProc( */ if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) { - int i, result = TCL_OK; + int i, res = TCL_OK; if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) { return TCL_ERROR; @@ -1844,7 +1844,7 @@ SerialSetOptionProc( for (i = 0; i < argc - 1; i += 2) { if (Tcl_GetBoolean(interp, argv[i+1], &flag) == TCL_ERROR) { - result = TCL_ERROR; + res = TCL_ERROR; break; } if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) { @@ -1856,7 +1856,7 @@ SerialSetOptionProc( Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE", "TTY_SIGNAL", NULL); } - result = TCL_ERROR; + res = TCL_ERROR; break; } } else if (strncasecmp(argv[i], "RTS", strlen(argv[i])) == 0) { @@ -1868,7 +1868,7 @@ SerialSetOptionProc( Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE", "TTY_SIGNAL", NULL); } - result = TCL_ERROR; + res = TCL_ERROR; break; } } else if (strncasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) { @@ -1880,7 +1880,7 @@ SerialSetOptionProc( Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE", "TTY_SIGNAL", NULL); } - result = TCL_ERROR; + res = TCL_ERROR; break; } } else { @@ -1891,13 +1891,13 @@ SerialSetOptionProc( Tcl_SetErrorCode(interp, "TCL", "VALUE", "TTY_SIGNAL", NULL); } - result = TCL_ERROR; + res = TCL_ERROR; break; } } Tcl_Free((void *)argv); - return result; + return res; } /* |