From d1b88bf5454e9c89b01ad2e1dba7a2516a3dcd0c Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 19 Mar 2024 17:09:30 +0000 Subject: more spacing/formatting tweaks --- generic/tclAssembly.c | 2 +- generic/tclBasic.c | 2 +- generic/tclCkalloc.c | 2 +- generic/tclCmdAH.c | 10 +-- generic/tclCompCmds.c | 12 ++-- generic/tclCompCmdsGR.c | 2 +- generic/tclCompCmdsSZ.c | 2 +- generic/tclCompile.c | 180 ++++++++++++++++++++++++------------------------ generic/tclEncoding.c | 44 ++++++------ generic/tclEnsemble.c | 3 +- generic/tclEvent.c | 10 +-- generic/tclExecute.c | 30 ++++---- generic/tclFileName.c | 2 +- generic/tclIO.c | 10 +-- generic/tclIOUtil.c | 6 +- generic/tclNamesp.c | 24 +++---- generic/tclOOBasic.c | 2 +- generic/tclOptimize.c | 18 ++--- generic/tclPathObj.c | 12 ++-- generic/tclProc.c | 6 +- generic/tclScan.c | 3 +- generic/tclStringObj.c | 11 ++- generic/tclTest.c | 80 +++++++++------------ generic/tclTestObj.c | 11 ++- generic/tclVar.c | 4 +- generic/tclZipfs.c | 12 ++-- unix/tclAppInit.c | 7 +- unix/tclSelectNotfy.c | 4 +- unix/tclUnixFCmd.c | 17 +++-- unix/tclUnixFile.c | 4 +- unix/tclUnixInit.c | 43 ++++++------ unix/tclUnixPipe.c | 9 ++- win/tclAppInit.c | 5 +- win/tclWinFile.c | 2 +- win/tclWinPipe.c | 3 +- win/tclWinSock.c | 4 +- win/tclWinTest.c | 13 +--- win/tclWinThrd.c | 9 ++- 38 files changed, 290 insertions(+), 330 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index b041670..cc1fe3b 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -1383,7 +1383,7 @@ AssembleOneLine( } if (opnd < 0 || opnd > 3) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("operand must be [0..3]", -1)); + Tcl_NewStringObj("operand must be [0..3]", -1)); Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND<0,>3", (void *)NULL); goto cleanup; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a2f4edc..3435eef 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6572,7 +6572,7 @@ int Tcl_ExprBooleanObj( Tcl_Interp *interp, /* Context in which to evaluate the * expression. */ - Tcl_Obj *objPtr, /* Expression to evaluate. */ + Tcl_Obj *objPtr, /* Expression to evaluate. */ int *ptr) /* Where to store 0/1 result. */ { Tcl_Obj *resultPtr; diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 6b989c9..1c12106 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -251,7 +251,7 @@ ValidateMemory( hiPtr = (unsigned char *)memHeaderP->body + memHeaderP->length; for (idx = 0; idx < HIGH_GUARD_SIZE; idx++) { - byte = *(hiPtr + idx); + byte = hiPtr[idx]; if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 85d8a1c..25d0441 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -822,7 +822,7 @@ EncodingSystemObjCmd( } if (objc == 1) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(Tcl_GetEncodingName(NULL), -1)); + Tcl_NewStringObj(Tcl_GetEncodingName(NULL), -1)); } else { return Tcl_SetSystemEncoding(interp, TclGetString(objv[1])); } @@ -1193,8 +1193,8 @@ FileAttrAccessTimeCmd( /* We use a value of 0 to indicate the access time not available */ if (Tcl_GetAccessTimeFromStat(&buf) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "could not get access time for file \"%s\"", - TclGetString(objv[1]))); + "could not get access time for file \"%s\"", + TclGetString(objv[1]))); return TCL_ERROR; } #endif @@ -1275,8 +1275,8 @@ FileAttrModifyTimeCmd( /* We use a value of 0 to indicate the modification time not available */ if (Tcl_GetModificationTimeFromStat(&buf) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "could not get modification time for file \"%s\"", - TclGetString(objv[1]))); + "could not get modification time for file \"%s\"", + TclGetString(objv[1]))); return TCL_ERROR; } #endif diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 98b1ec6..2e61d11 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -776,11 +776,11 @@ TclCompileClockClicksCmd( || tokenPtr[1].size > 13) { return TCL_ERROR; } else if (!strncmp(tokenPtr[1].start, "-microseconds", - tokenPtr[1].size)) { + tokenPtr[1].size)) { TclEmitInstInt1(INST_CLOCK_READ, 1, envPtr); break; } else if (!strncmp(tokenPtr[1].start, "-milliseconds", - tokenPtr[1].size)) { + tokenPtr[1].size)) { TclEmitInstInt1(INST_CLOCK_READ, 2, envPtr); break; } else { @@ -3452,8 +3452,10 @@ TclLocalScalar( size_t numBytes, CompileEnv *envPtr) { - Tcl_Token token[2] = {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, - {TCL_TOKEN_TEXT, NULL, 0, 0}}; + Tcl_Token token[2] = { + {TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1}, + {TCL_TOKEN_TEXT, NULL, 0, 0} + }; token[1].start = bytes; token[1].size = numBytes; @@ -3640,7 +3642,7 @@ TclPushVarName( int hasNsQualifiers = 0; for (p = name, last = p + nameLen-1; p < last; p++) { - if ((*p == ':') && (*(p+1) == ':')) { + if ((p[0] == ':') && (p[1] == ':')) { hasNsQualifiers = 1; break; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index f35cd50..63f9e07 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2754,7 +2754,7 @@ IndexTailVarIfKnown( */ for (p = tailName + len -1; p > tailName; p--) { - if ((*p == ':') && (*(p - 1) == ':')) { + if ((p[0] == ':') && (p[- 1] == ':')) { p++; break; } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 5f221bd..09881cc 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -235,7 +235,7 @@ TclCompileStringCatCmd( } /* General case: issue CONCAT1's (by chunks of 254 if needed), folding - contiguous constants along the way */ + * contiguous constants along the way */ numArgs = 0; folded = NULL; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 9866ce2..0fc3e48 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2195,114 +2195,114 @@ TclCompileScript( /* Each iteration compiles one command from the script. */ if (numBytes > 0) { - if (numBytes >= INT_MAX) { - /* - * Note this gets -errorline as 1. Not worth figuring out which line - * crosses the limit to get -errorline for this error case. - */ - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "Script length %" TCL_SIZE_MODIFIER - "d exceeds max permitted length %d.", - numBytes, INT_MAX-1)); - Tcl_SetErrorCode(interp, "TCL", "LIMIT", "SCRIPTLENGTH", (void *)NULL); - TclCompileSyntaxError(interp, envPtr); - return; - } - /* - * Don't use system stack (size of Tcl_Parse is ca. 400 bytes), so - * many nested compilations (body enclosed in body) can cause abnormal - * program termination with a stack overflow exception, bug [fec0c17d39]. - */ - Tcl_Parse *parsePtr = (Tcl_Parse *)Tcl_Alloc(sizeof(Tcl_Parse)); - - do { - const char *next; - - if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, parsePtr)) { + if (numBytes >= INT_MAX) { /* - * Compile bytecodes to report the parsePtr error at runtime. + * Note this gets -errorline as 1. Not worth figuring out which line + * crosses the limit to get -errorline for this error case. */ - - Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, - parsePtr->term + 1 - parsePtr->commandStart); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "Script length %" TCL_SIZE_MODIFIER + "d exceeds max permitted length %d.", + numBytes, INT_MAX-1)); + Tcl_SetErrorCode(interp, "TCL", "LIMIT", "SCRIPTLENGTH", (void *)NULL); TclCompileSyntaxError(interp, envPtr); - Tcl_Free(parsePtr); return; } - -#ifdef TCL_COMPILE_DEBUG /* - * If tracing, print a line for each top level command compiled. - * TODO: Suppress when numWords == 0 ? + * Don't use system stack (size of Tcl_Parse is ca. 400 bytes), so + * many nested compilations (body enclosed in body) can cause abnormal + * program termination with a stack overflow exception, bug [fec0c17d39]. */ + Tcl_Parse *parsePtr = (Tcl_Parse *)Tcl_Alloc(sizeof(Tcl_Parse)); - if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { - int commandLength = parsePtr->term - parsePtr->commandStart; - fprintf(stdout, " Compiling: "); - TclPrintSource(stdout, parsePtr->commandStart, - TclMin(commandLength, 55)); - fprintf(stdout, "\n"); - } -#endif + do { + const char *next; - /* - * TIP #280: Count newlines before the command start. - * (See test info-30.33). - */ + if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, parsePtr)) { + /* + * Compile bytecodes to report the parsePtr error at runtime. + */ + + Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, + parsePtr->term + 1 - parsePtr->commandStart); + TclCompileSyntaxError(interp, envPtr); + Tcl_Free(parsePtr); + return; + } - TclAdvanceLines(&envPtr->line, p, parsePtr->commandStart); - TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, - parsePtr->commandStart - envPtr->source); +#ifdef TCL_COMPILE_DEBUG + /* + * If tracing, print a line for each top level command compiled. + * TODO: Suppress when numWords == 0 ? + */ - /* - * Advance parser to the next command in the script. - */ + if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { + int commandLength = parsePtr->term - parsePtr->commandStart; + fprintf(stdout, " Compiling: "); + TclPrintSource(stdout, parsePtr->commandStart, + TclMin(commandLength, 55)); + fprintf(stdout, "\n"); + } +#endif - next = parsePtr->commandStart + parsePtr->commandSize; - numBytes -= next - p; - p = next; + /* + * TIP #280: Count newlines before the command start. + * (See test info-30.33). + */ + + TclAdvanceLines(&envPtr->line, p, parsePtr->commandStart); + TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, + parsePtr->commandStart - envPtr->source); - if (parsePtr->numWords == 0) { /* - * The "command" parsed has no words. In this case we can skip - * the rest of the loop body. With no words, clearly - * CompileCommandTokens() has nothing to do. Since the parser - * aggressively sucks up leading comment and white space, - * including newlines, parsePtr->commandStart must be pointing at - * either the end of script, or a command-terminating semi-colon. - * In either case, the TclAdvance*() calls have nothing to do. - * Finally, when no words are parsed, no tokens have been - * allocated at parsePtr->tokenPtr so there's also nothing for - * Tcl_FreeParse() to do. - * - * The advantage of this shortcut is that CompileCommandTokens() - * can be written with an assumption that (int)parsePtr->numWords > 0, with - * the implication the CCT() always generates bytecode. + * Advance parser to the next command in the script. */ - continue; - } - /* - * Avoid stack exhaustion by too many nested calls of TclCompileScript - * (considering interp recursionlimit). - */ - iPtr->numLevels++; + next = parsePtr->commandStart + parsePtr->commandSize; + numBytes -= next - p; + p = next; + + if (parsePtr->numWords == 0) { + /* + * The "command" parsed has no words. In this case we can skip + * the rest of the loop body. With no words, clearly + * CompileCommandTokens() has nothing to do. Since the parser + * aggressively sucks up leading comment and white space, + * including newlines, parsePtr->commandStart must be pointing at + * either the end of script, or a command-terminating semi-colon. + * In either case, the TclAdvance*() calls have nothing to do. + * Finally, when no words are parsed, no tokens have been + * allocated at parsePtr->tokenPtr so there's also nothing for + * Tcl_FreeParse() to do. + * + * The advantage of this shortcut is that CompileCommandTokens() + * can be written with an assumption that (int)parsePtr->numWords > 0, with + * the implication the CCT() always generates bytecode. + */ + continue; + } + + /* + * Avoid stack exhaustion by too many nested calls of TclCompileScript + * (considering interp recursionlimit). + */ + iPtr->numLevels++; - lastCmdIdx = CompileCommandTokens(interp, parsePtr, envPtr); + lastCmdIdx = CompileCommandTokens(interp, parsePtr, envPtr); - iPtr->numLevels--; + iPtr->numLevels--; - /* - * TIP #280: Track lines in the just compiled command. - */ + /* + * TIP #280: Track lines in the just compiled command. + */ - TclAdvanceLines(&envPtr->line, parsePtr->commandStart, p); - TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, - p - envPtr->source); - Tcl_FreeParse(parsePtr); - } while (numBytes > 0); + TclAdvanceLines(&envPtr->line, parsePtr->commandStart, p); + TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, + p - envPtr->source); + Tcl_FreeParse(parsePtr); + } while (numBytes > 0); - Tcl_Free(parsePtr); + Tcl_Free(parsePtr); } if (lastCmdIdx == -1) { @@ -2374,12 +2374,12 @@ TclCompileVarSubst( */ for (i = 0, p = name; i < nameBytes; i++, p++) { - if ((*p == ':') && (i < nameBytes-1) && (*(p+1) == ':')) { + if ((p[0] == ':') && (i < nameBytes-1) && (p[1] == ':')) { localVarName = -1; break; - } else if ((*p == '(') + } else if ((p[0] == '(') && (tokenPtr->numComponents == 1) - && (*(name + nameBytes - 1) == ')')) { + && (name[nameBytes - 1] == ')')) { localVarName = 0; break; } diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1b71026..074c58e 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1049,30 +1049,30 @@ Tcl_CreateEncoding( encodingPtr->refCount = 1; encodingPtr->hPtr = NULL; - if (typePtr->encodingName) { - Tcl_HashEntry *hPtr; - int isNew; - char *name; + if (typePtr->encodingName) { + Tcl_HashEntry *hPtr; + int isNew; + char *name; - Tcl_MutexLock(&encodingMutex); - hPtr = Tcl_CreateHashEntry(&encodingTable, typePtr->encodingName, &isNew); - if (isNew == 0) { - /* - * Remove old encoding from hash table, but don't delete it until last - * reference goes away. - */ + Tcl_MutexLock(&encodingMutex); + hPtr = Tcl_CreateHashEntry(&encodingTable, typePtr->encodingName, &isNew); + if (isNew == 0) { + /* + * Remove old encoding from hash table, but don't delete it until last + * reference goes away. + */ - Encoding *replaceMe = (Encoding *)Tcl_GetHashValue(hPtr); - replaceMe->hPtr = NULL; - } + Encoding *replaceMe = (Encoding *)Tcl_GetHashValue(hPtr); + replaceMe->hPtr = NULL; + } - name = (char *)Tcl_Alloc(strlen(typePtr->encodingName) + 1); - encodingPtr->name = strcpy(name, typePtr->encodingName); - encodingPtr->hPtr = hPtr; - Tcl_SetHashValue(hPtr, encodingPtr); + name = (char *) Tcl_Alloc(strlen(typePtr->encodingName) + 1); + encodingPtr->name = strcpy(name, typePtr->encodingName); + encodingPtr->hPtr = hPtr; + Tcl_SetHashValue(hPtr, encodingPtr); - Tcl_MutexUnlock(&encodingMutex); - } + Tcl_MutexUnlock(&encodingMutex); + } return (Tcl_Encoding) encodingPtr; } @@ -1545,8 +1545,8 @@ Tcl_UtfToExternalDStringEx( dstChunkLen = dstLen > INT_MAX ? INT_MAX : dstLen; result = encodingPtr->fromUtfProc(encodingPtr->clientData, src, - srcChunkLen, flags, &state, dst, dstChunkLen, - &srcChunkRead, &dstChunkWrote, &dstChunkChars); + srcChunkLen, flags, &state, dst, dstChunkLen, + &srcChunkRead, &dstChunkWrote, &dstChunkChars); soFar = dst + dstChunkWrote - Tcl_DStringValue(dstPtr); /* Move past the part processed in this go around */ diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index f4d4504..1769324 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -1818,8 +1818,7 @@ NsEnsembleImplementationCmdNR( */ const char *subcmdName; /* Name of the subcommand or unique prefix of - * it (a non-unique prefix produces an error). - */ + * it (a non-unique prefix produces an error). */ char *fullName = NULL; /* Full name of the subcommand. */ Tcl_Size stringLength, i; Tcl_Size tableLength = ensemblePtr->subcommandTable.numEntries; diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 23925f2..69c3c27 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1593,8 +1593,8 @@ Tcl_VwaitObjCmd( goto needArg; } result = Tcl_TraceVar2(interp, TclGetString(objv[i]), NULL, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VwaitVarProc, &vwaitItems[numItems]); + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + VwaitVarProc, &vwaitItems[numItems]); if (result != TCL_OK) { goto done; } @@ -1675,8 +1675,8 @@ Tcl_VwaitObjCmd( for (result = TCL_OK; i < objc; i++) { result = Tcl_TraceVar2(interp, TclGetString(objv[i]), NULL, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VwaitVarProc, &vwaitItems[numItems]); + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + VwaitVarProc, &vwaitItems[numItems]); if (result != TCL_OK) { break; } @@ -1709,7 +1709,7 @@ Tcl_VwaitObjCmd( vwaitItems[numItems].mask = 0; vwaitItems[numItems].sourceObj = NULL; timer = Tcl_CreateTimerHandler(timeout, VwaitTimeoutProc, - &vwaitItems[numItems]); + &vwaitItems[numItems]); Tcl_GetTime(&before); } else { timeout = 0; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ac27a87..f4c223c 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -361,9 +361,9 @@ VarHashCreateVar( #define OBJ_AT_TOS *tosPtr -#define OBJ_UNDER_TOS *(tosPtr-1) +#define OBJ_UNDER_TOS tosPtr[-1] -#define OBJ_AT_DEPTH(n) *(tosPtr-(n)) +#define OBJ_AT_DEPTH(n) tosPtr[-(n)] #define CURR_DEPTH (tosPtr - initTosPtr) @@ -379,8 +379,8 @@ VarHashCreateVar( # define TRACE(a) \ while (traceInstructions) { \ fprintf(stdout, "%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d (%" TCL_T_MODIFIER "d) %s ", iPtr->numLevels, \ - CURR_DEPTH, \ - (pc - codePtr->codeStart), \ + CURR_DEPTH, \ + (pc - codePtr->codeStart), \ GetOpcodeName(pc)); \ printf a; \ break; \ @@ -395,8 +395,8 @@ VarHashCreateVar( # define TRACE_WITH_OBJ(a, objPtr) \ while (traceInstructions) { \ fprintf(stdout, "%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d (%" TCL_T_MODIFIER "d) %s ", iPtr->numLevels, \ - CURR_DEPTH, \ - (pc - codePtr->codeStart), \ + CURR_DEPTH, \ + (pc - codePtr->codeStart), \ GetOpcodeName(pc)); \ printf a; \ TclPrintObject(stdout, objPtr, 30); \ @@ -450,15 +450,15 @@ VarHashCreateVar( */ #define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ - ((TclHasInternalRep((objPtr), &tclIntType)) \ + ((TclHasInternalRep((objPtr), &tclIntType)) \ ? (*(tPtr) = TCL_NUMBER_INT, \ - *(ptrPtr) = (void *) \ + *(ptrPtr) = (void *) \ (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ TclHasInternalRep((objPtr), &tclDoubleType) \ ? (((isnan((objPtr)->internalRep.doubleValue)) \ ? (*(tPtr) = TCL_NUMBER_NAN) \ : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ - *(ptrPtr) = (void *) \ + *(ptrPtr) = (void *) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ (((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \ ? TCL_ERROR : \ @@ -3123,7 +3123,7 @@ TEBCresume( objResultPtr = OBJ_AT_TOS; varPtr->value.objPtr = objResultPtr; #ifndef TCL_COMPILE_DEBUG - if (*(pc+pcAdjustment) == INST_POP) { + if (pc[pcAdjustment] == INST_POP) { tosPtr--; NEXT_INST_F((pcAdjustment+1), 0, 0); } @@ -3287,7 +3287,7 @@ TEBCresume( goto gotError; } #ifndef TCL_COMPILE_DEBUG - if (*(pc+pcAdjustment) == INST_POP) { + if (pc[pcAdjustment] == INST_POP) { NEXT_INST_V((pcAdjustment+1), cleanup, 0); } #endif @@ -3686,7 +3686,7 @@ TEBCresume( doneIncr: TRACE_APPEND(("%.30s\n", O2S(objResultPtr))); #ifndef TCL_COMPILE_DEBUG - if (*(pc+pcAdjustment) == INST_POP) { + if (pc[pcAdjustment] == INST_POP) { NEXT_INST_V((pcAdjustment+1), cleanup, 0); } #endif @@ -5009,7 +5009,7 @@ TEBCresume( */ #ifndef TCL_COMPILE_DEBUG - if (*(pc+9) == INST_POP) { + if (pc[9] == INST_POP) { NEXT_INST_F(10, 1, 0); } #endif @@ -6993,7 +6993,7 @@ TEBCresume( } } #ifndef TCL_COMPILE_DEBUG - if (*(pc+9) == INST_POP) { + if (pc[9] == INST_POP) { NEXT_INST_V(10, cleanup, 0); } #endif @@ -7132,7 +7132,7 @@ TEBCresume( } } #ifndef TCL_COMPILE_DEBUG - if (*(pc+5) == INST_POP) { + if (pc[5] == INST_POP) { NEXT_INST_F(6, 2, 0); } #endif diff --git a/generic/tclFileName.c b/generic/tclFileName.c index baa915d..847b225 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1267,7 +1267,7 @@ Tcl_GlobObjCmd( last = first + pathlength; for (; last != first; last--) { - if (strchr(separators, *(last-1)) != NULL) { + if (strchr(separators, last[-1]) != NULL) { break; } } diff --git a/generic/tclIO.c b/generic/tclIO.c index df9f665..f52edc4 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -647,7 +647,7 @@ TclFinalizeIOSubsystem(void) */ (void) Tcl_SetChannelOption(NULL, (Tcl_Channel) chanPtr, - "-blocking", "on"); + "-blocking", "on"); } if ((chanPtr == (Channel *) tsdPtr->stdinChannel) || @@ -2448,13 +2448,13 @@ Tcl_GetChannelHandle( int Tcl_RemoveChannelMode( - Tcl_Interp* interp, /* The interp for an error message. Allowed to be NULL. */ + Tcl_Interp *interp, /* The interp for an error message. Allowed to be NULL. */ Tcl_Channel chan, /* The channel which is modified. */ - int mode) /* The access mode to drop from the channel */ + int mode) /* The access mode to drop from the channel */ { const char* emsg; ChannelState *statePtr = ((Channel *) chan)->state; - /* State of actual channel. */ + /* State of actual channel. */ if ((mode != TCL_READABLE) && (mode != TCL_WRITABLE)) { emsg = "Illegal mode value."; @@ -3564,7 +3564,7 @@ TclClose( Tcl_SetErrno(stickyError); if (interp != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(Tcl_PosixError(interp), -1)); + Tcl_NewStringObj(Tcl_PosixError(interp), -1)); } return TCL_ERROR; } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index b892d65..af0e101 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -4351,16 +4351,14 @@ Tcl_FSCopyDirectory( int Tcl_FSRemoveDirectory( - Tcl_Obj *pathPtr, /* The pathname of the directory to be removed. - */ + Tcl_Obj *pathPtr, /* The pathname of the directory to be removed. */ int recursive, /* If zero, removes only an empty directory. * Otherwise, removes the directory and all its * contents. */ Tcl_Obj **errorPtr) /* If not NULL and an error occurs, stores a * place to store a a pointer to a new * object having a refCount of 1 and containing - * the name of the file that produced an error. - * */ + * the name of the file that produced an error. */ { const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 2268609..bdff82d 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -2260,13 +2260,13 @@ TclGetNamespaceForQualName( start = qualName; /* Points to start of qualifying * namespace. */ - if ((*qualName == ':') && (*(qualName+1) == ':')) { - start = qualName+2; /* Skip over the initial :: */ - while (*start == ':') { + if ((qualName[0] == ':') && (qualName[1] == ':')) { + start = qualName + 2; /* Skip over the initial :: */ + while (start[0] == ':') { start++; /* Skip over a subsequent : */ } nsPtr = globalNsPtr; - if (*start == '\0') { /* qualName is just two or more + if (start[0] == '\0') { /* qualName is just two or more * ":"s. */ *nsPtrPtr = globalNsPtr; *altNsPtrPtr = NULL; @@ -2306,7 +2306,7 @@ TclGetNamespaceForQualName( len = 0; for (end = start; *end != '\0'; end++) { - if ((*end == ':') && (*(end+1) == ':')) { + if ((end[0] == ':') && (end[1] == ':')) { end += 2; /* Skip over the initial :: */ while (*end == ':') { end++; /* Skip over the subsequent : */ @@ -2316,7 +2316,7 @@ TclGetNamespaceForQualName( len++; } - if (*end=='\0' && !(end-start>=2 && *(end-1)==':' && *(end-2)==':')) { + if (end[0]=='\0' && !(end-start>=2 && end[-1]==':' && end[-2]==':')) { /* * qualName ended with a simple name at start. If TCL_FIND_ONLY_NS * was specified, look this up as a namespace. Otherwise, start is @@ -2436,7 +2436,7 @@ TclGetNamespaceForQualName( * variable name, trailing "::"s refer to the cmd or var named {}. */ - if ((flags & TCL_FIND_ONLY_NS) || (end>start && *(end-1)!=':')) { + if ((flags & TCL_FIND_ONLY_NS) || (end>start && end[-1]!=':')) { *simpleNamePtr = NULL; /* Found namespace name. */ } else { *simpleNamePtr = end; /* Found cmd/var: points to empty @@ -3058,7 +3058,7 @@ NamespaceChildrenCmd( if (objc == 3) { const char *name = TclGetString(objv[2]); - if ((*name == ':') && (*(name+1) == ':')) { + if ((name[0] == ':') && (name[1] == ':')) { pattern = name; } else { Tcl_DStringAppend(&buffer, nsPtr->fullName, -1); @@ -4291,13 +4291,13 @@ NamespaceQualifiersCmd( */ name = TclGetString(objv[1]); - for (p = name; *p != '\0'; p++) { + for (p = name; p[0] != '\0'; p++) { /* empty body */ } while (--p >= name) { - if ((*p == ':') && (p > name) && (*(p-1) == ':')) { + if ((p[0] == ':') && (p > name) && (p[-1] == ':')) { p -= 2; /* Back up over the :: */ - while ((p >= name) && (*p == ':')) { + while ((p >= name) && (p[0] == ':')) { p--; /* Back up over the preceding : */ } break; @@ -4549,7 +4549,7 @@ NamespaceTailCmd( /* empty body */ } while (--p > name) { - if ((*p == ':') && (*(p-1) == ':')) { + if ((p[0] == ':') && (p[-1] == ':')) { p++; /* Just after the last "::" */ break; } diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 5a38dee..b1b36e0 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -1281,7 +1281,7 @@ TclOOCopyObjectCmd( if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, - "sourceName ?targetName? ?targetNamespace?"); + "sourceName ?targetName? ?targetNamespace?"); return TCL_ERROR; } diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index 7a4a962..247c326 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -214,7 +214,7 @@ ConvertZeroEffectToNOP( size = AddrLength(currentInstPtr); while ((currentInstPtr + size < envPtr->codeNext) - && *(currentInstPtr+size) == INST_NOP) { + && currentInstPtr[size] == INST_NOP) { if (IsTargetAddress(&targets, currentInstPtr + size)) { break; } @@ -223,7 +223,7 @@ ConvertZeroEffectToNOP( if (IsTargetAddress(&targets, currentInstPtr + size)) { continue; } - nextInst = *(currentInstPtr + size); + nextInst = currentInstPtr[size]; switch (*currentInstPtr) { case INST_PUSH1: if (nextInst == INST_POP) { @@ -260,19 +260,19 @@ ConvertZeroEffectToNOP( switch (nextInst) { case INST_JUMP_TRUE1: blank = size; - *(currentInstPtr + size) = INST_JUMP_FALSE1; + currentInstPtr[size] = INST_JUMP_FALSE1; break; case INST_JUMP_FALSE1: blank = size; - *(currentInstPtr + size) = INST_JUMP_TRUE1; + currentInstPtr[size] = INST_JUMP_TRUE1; break; case INST_JUMP_TRUE4: blank = size; - *(currentInstPtr + size) = INST_JUMP_FALSE4; + currentInstPtr[size] = INST_JUMP_FALSE4; break; case INST_JUMP_FALSE4: blank = size; - *(currentInstPtr + size) = INST_JUMP_TRUE4; + currentInstPtr[size] = INST_JUMP_TRUE4; break; } break; @@ -318,7 +318,7 @@ ConvertZeroEffectToNOP( if (blank > 0) { for (i=0 ; i current user */ const char *subPath, /* Rest of path. May be NULL */ Tcl_DString *dsPtr) /* Output. Is initialized by the function. Must be - freed on success */ + * freed on success */ { const char *dir; Tcl_DString dirString; @@ -2489,10 +2489,10 @@ MakeTildeRelativePath( if (dir == NULL) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't find HOME environment variable to" - " expand path", -1)); + "couldn't find HOME environment variable to expand path", + -1)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "PATH", - "HOMELESS", (void *)NULL); + "HOMELESS", (void *)NULL); } return TCL_ERROR; } @@ -2502,9 +2502,9 @@ MakeTildeRelativePath( if (dir == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "user \"%s\" doesn't exist", user)); + "user \"%s\" doesn't exist", user)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "PATH", "NOUSER", - (void *)NULL); + (void *)NULL); } return TCL_ERROR; } diff --git a/generic/tclProc.c b/generic/tclProc.c index 419b9eb..ebd7681 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -559,9 +559,9 @@ TclCreateProc( "FORMALARGUMENTFORMAT", (void *)NULL); goto procError; } - } else if (*argnamei == ':' && *(argnamei+1) == ':') { + } else if (argnamei[0] == ':' && argnamei[1] == ':') { Tcl_Obj *errorObj = Tcl_NewStringObj( - "formal parameter \"", -1); + "formal parameter \"", -1); Tcl_AppendObjToObj(errorObj, fieldValues[0]); Tcl_AppendToObj(errorObj, "\" is not a simple name", -1); Tcl_SetObjResult(interp, errorObj); @@ -2592,7 +2592,7 @@ SetLambdaFromAny( } else { const char *nsName = TclGetString(objv[2]); - if ((*nsName != ':') || (*(nsName+1) != ':')) { + if ((nsName[0] != ':') || (nsName[1] != ':')) { TclNewLiteralStringObj(nsObjPtr, "::"); Tcl_AppendObjToObj(nsObjPtr, objv[2]); } else { diff --git a/generic/tclScan.c b/generic/tclScan.c index 1fc7e97..195153b 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -325,8 +325,7 @@ ValidateFormat( objIndex = (int) ull - 1; if (numVars && (objIndex >= numVars)) { goto badIndex; - } - else if (numVars == 0) { + } else if (numVars == 0) { /* * In the case where no vars are specified, the user can * specify %9999$ legally, so we have to consider special diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4f1a145..d8b96f7 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -181,14 +181,11 @@ GrowUnicodeBuffer( } if (stringPtr->maxChars > 0) { /* Expansion - try allocating extra space */ - stringPtr = (String *)TclReallocElemsEx(stringPtr, - needed + 1, /* +1 for nul */ - sizeof(Tcl_UniChar), - offsetof(String, unicode), - &maxChars); + stringPtr = (String *) TclReallocElemsEx(stringPtr, + needed + 1, /* +1 for nul */ + sizeof(Tcl_UniChar), offsetof(String, unicode), &maxChars); maxChars -= 1; /* End nul not included */ - } - else { + } else { /* * First allocation - just big enough. Note needed does * not include terminating nul but STRING_SIZE does diff --git a/generic/tclTest.c b/generic/tclTest.c index 3e818ac..c0ce8db 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -688,7 +688,7 @@ Tcltest_Init( Tcl_CreateObjCommand(interp, "testnumutfchars", TestNumUtfCharsCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testgetunichar", - TestGetUniCharCmd, NULL, NULL); + TestGetUniCharCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfindfirst", TestFindFirstCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfindlast", @@ -1908,9 +1908,9 @@ TestdoubledigitsObjCmd( } } if (status != TCL_OK - || Tcl_GetIntFromObj(interp, objv[2], &ndigits) != TCL_OK - || Tcl_GetIndexFromObj(interp, objv[3], options, "conversion type", - TCL_EXACT, &type) != TCL_OK) { + || Tcl_GetIntFromObj(interp, objv[2], &ndigits) != TCL_OK + || Tcl_GetIndexFromObj(interp, objv[3], options, "conversion type", + TCL_EXACT, &type) != TCL_OK) { fprintf(stderr, "bad value? %g\n", d); return TCL_ERROR; } @@ -2136,10 +2136,8 @@ static int UtfExtWrapper( Tcl_WideInt wide; if (objc < 7 || objc > 10) { - Tcl_WrongNumArgs(interp, - 2, - objv, - "encoding srcbytes flags state dstlen ?srcreadvar? ?dstwrotevar? ?dstcharsvar?"); + Tcl_WrongNumArgs(interp, 2, objv, + "encoding srcbytes flags state dstlen ?srcreadvar? ?dstwrotevar? ?dstcharsvar?"); return TCL_ERROR; } if (Tcl_GetEncodingFromObj(interp, objv[2], &encoding) != TCL_OK) { @@ -2158,13 +2156,8 @@ static int UtfExtWrapper( flags |= flag; } else { int idx; - if (Tcl_GetIndexFromObjStruct(interp, - flagObjs[i], - flagMap, - sizeof(flagMap[0]), - "flag", - 0, - &idx) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, flagObjs[i], flagMap, sizeof(flagMap[0]), + "flag", 0, &idx) != TCL_OK) { return TCL_ERROR; } flags |= flagMap[idx].flag; @@ -2228,14 +2221,14 @@ static int UtfExtWrapper( memmove(bufPtr + dstLen, "\xAB\xCD\xEF\xAB", 4); /* overflow detection */ bytes = Tcl_GetByteArrayFromObj(objv[3], &srcLen); /* Last! to avoid shimmering */ result = (*transformer)(interp, encoding, (const char *)bytes, srcLen, flags, - encStatePtr, (char *) bufPtr, dstLen, - srcReadVar ? &srcRead : NULL, - &dstWrote, - dstCharsVar ? &dstChars : NULL); + encStatePtr, (char *) bufPtr, dstLen, + srcReadVar ? &srcRead : NULL, + &dstWrote, + dstCharsVar ? &dstChars : NULL); if (memcmp(bufPtr + bufLen - 4, "\xAB\xCD\xEF\xAB", 4)) { Tcl_SetResult(interp, - "Tcl_ExternalToUtf wrote past output buffer", - TCL_STATIC); + "Tcl_ExternalToUtf wrote past output buffer", + TCL_STATIC); result = TCL_ERROR; } else if (result != TCL_ERROR) { Tcl_Obj *resultObjs[3]; @@ -2264,29 +2257,20 @@ static int UtfExtWrapper( encStatePtr ? Tcl_NewWideIntObj((Tcl_WideInt)(size_t)encState) : Tcl_NewObj(); resultObjs[2] = Tcl_NewByteArrayObj(bufPtr, dstLen); if (srcReadVar) { - if (Tcl_ObjSetVar2(interp, - srcReadVar, - NULL, - Tcl_NewIntObj(srcRead), - TCL_LEAVE_ERR_MSG) == NULL) { + if (Tcl_ObjSetVar2(interp, srcReadVar, NULL, Tcl_NewIntObj(srcRead), + TCL_LEAVE_ERR_MSG) == NULL) { result = TCL_ERROR; } } if (dstWroteVar) { - if (Tcl_ObjSetVar2(interp, - dstWroteVar, - NULL, - Tcl_NewIntObj(dstWrote), - TCL_LEAVE_ERR_MSG) == NULL) { + if (Tcl_ObjSetVar2(interp, dstWroteVar, NULL, Tcl_NewIntObj(dstWrote), + TCL_LEAVE_ERR_MSG) == NULL) { result = TCL_ERROR; } } if (dstCharsVar) { - if (Tcl_ObjSetVar2(interp, - dstCharsVar, - NULL, - Tcl_NewIntObj(dstChars), - TCL_LEAVE_ERR_MSG) == NULL) { + if (Tcl_ObjSetVar2(interp, dstCharsVar, NULL, Tcl_NewIntObj(dstChars), + TCL_LEAVE_ERR_MSG) == NULL) { result = TCL_ERROR; } } @@ -2397,7 +2381,7 @@ TestencodingObjCmd( return TCL_ERROR; } Tcl_SetObjResult(interp, - Tcl_NewIntObj(Tcl_GetEncodingNulLength(encoding))); + Tcl_NewIntObj(Tcl_GetEncodingNulLength(encoding))); Tcl_FreeEncoding(encoding); break; case ENC_EXTTOUTF: @@ -3332,7 +3316,7 @@ TestlinkCmd( } flag = writable ? 0 : TCL_LINK_READ_ONLY; if (Tcl_LinkVar(interp, "wide", &wideVar, - TCL_LINK_WIDE_INT | flag) != TCL_OK) { + TCL_LINK_WIDE_INT | flag) != TCL_OK) { return TCL_ERROR; } if (Tcl_GetBoolean(interp, argv[7], &writable) != TCL_OK) { @@ -3929,10 +3913,10 @@ TestlistrepCmd( ListObjGetRep(objv[2], &listRep); listRepObjs[0] = Tcl_NewStringObj("store", -1); listRepObjs[1] = Tcl_NewListObj(12, NULL); - Tcl_ListObjAppendElement( - interp, listRepObjs[1], Tcl_NewStringObj("memoryAddress", -1)); - Tcl_ListObjAppendElement( - interp, listRepObjs[1], Tcl_ObjPrintf("%p", listRep.storePtr)); + Tcl_ListObjAppendElement(interp, listRepObjs[1], + Tcl_NewStringObj("memoryAddress", -1)); + Tcl_ListObjAppendElement(interp, listRepObjs[1], + Tcl_ObjPrintf("%p", listRep.storePtr)); APPEND_FIELD(listRepObjs[1], listRep.storePtr, firstUsed); APPEND_FIELD(listRepObjs[1], listRep.storePtr, numUsed); APPEND_FIELD(listRepObjs[1], listRep.storePtr, numAllocated); @@ -3941,14 +3925,12 @@ TestlistrepCmd( if (listRep.spanPtr) { listRepObjs[2] = Tcl_NewStringObj("span", -1); listRepObjs[3] = Tcl_NewListObj(8, NULL); - Tcl_ListObjAppendElement(interp, - listRepObjs[3], - Tcl_NewStringObj("memoryAddress", -1)); - Tcl_ListObjAppendElement( - interp, listRepObjs[3], Tcl_ObjPrintf("%p", listRep.spanPtr)); + Tcl_ListObjAppendElement(interp, listRepObjs[3], + Tcl_NewStringObj("memoryAddress", -1)); + Tcl_ListObjAppendElement(interp, listRepObjs[3], + Tcl_ObjPrintf("%p", listRep.spanPtr)); APPEND_FIELD(listRepObjs[3], listRep.spanPtr, spanStart); - APPEND_FIELD( - listRepObjs[3], listRep.spanPtr, spanLength); + APPEND_FIELD(listRepObjs[3], listRep.spanPtr, spanLength); APPEND_FIELD(listRepObjs[3], listRep.spanPtr, refCount); } resultObj = Tcl_NewListObj(listRep.spanPtr ? 4 : 2, listRepObjs); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 1714aad..cfca015 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -414,7 +414,7 @@ TestbooleanobjCmd( return TCL_ERROR; } if (Tcl_GetBooleanFromObj(interp, varPtr[varIndex], - &boolValue) != TCL_OK) { + &boolValue) != TCL_OK) { return TCL_ERROR; } if (!Tcl_IsShared(varPtr[varIndex])) { @@ -514,7 +514,7 @@ TestdoubleobjCmd( return TCL_ERROR; } if (Tcl_GetDoubleFromObj(interp, varPtr[varIndex], - &doubleValue) != TCL_OK) { + &doubleValue) != TCL_OK) { return TCL_ERROR; } if (!Tcl_IsShared(varPtr[varIndex])) { @@ -953,7 +953,7 @@ TestlistobjCmd( case LISTOBJ_REPLACE: if (objc < 5) { Tcl_WrongNumArgs(interp, 2, objv, - "varIndex start count ?element...?"); + "varIndex start count ?element...?"); return TCL_ERROR; } if (Tcl_GetIntForIndex(interp, objv[3], TCL_INDEX_NONE, &first) != TCL_OK @@ -965,7 +965,7 @@ TestlistobjCmd( } Tcl_ResetResult(interp); return Tcl_ListObjReplace(interp, varPtr[varIndex], first, count, - objc-5, objv+5); + objc-5, objv+5); case LISTOBJ_INDEXMEMCHECK: if (objc != 3) { @@ -1023,8 +1023,7 @@ TestlistobjCmd( * Hence this explicit test. */ if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, - "varIndex listIndex"); + Tcl_WrongNumArgs(interp, 2, objv, "varIndex listIndex"); return TCL_ERROR; } if (Tcl_GetIntForIndex(interp, objv[3], TCL_INDEX_NONE, &first) != TCL_OK) { diff --git a/generic/tclVar.c b/generic/tclVar.c index 1f5431c..ceac15d 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -914,7 +914,7 @@ TclLookupSimpleVar( const char *tail; int lookGlobal = (flags & TCL_GLOBAL_ONLY) || (cxtNsPtr == iPtr->globalNsPtr) - || ((*varName == ':') && (*(varName+1) == ':')); + || ((varName[0] == ':') && (varName[1] == ':')); if (lookGlobal) { *indexPtr = -1; @@ -4971,7 +4971,7 @@ Tcl_GlobalObjCmd( for (tail=varName ; *tail!='\0' ; tail++) { /* empty body */ } - while ((tail > varName) && ((*tail != ':') || (*(tail-1) != ':'))) { + while ((tail > varName) && ((tail[0] != ':') || (tail[-1] != ':'))) { tail--; } if ((*tail == ':') && (tail > varName)) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 3aaeb6c..236fe72 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -2469,16 +2469,14 @@ TclZipfs_MountBuffer( } memcpy(zf->data, data, datalen); zf->ptrToFree = zf->data; - } - else { + } else { zf->data = (unsigned char *)data; zf->ptrToFree = NULL; } ret = ZipFSFindTOC(interp, 1, zf); if (ret != TCL_OK) { Tcl_Free(zf); - } - else { + } else { /* Note ZipFSCatalogFilesystem will free zf on error */ ret = ZipFSCatalogFilesystem( interp, zf, mountPoint, NULL, "Memory Buffer"); @@ -5046,8 +5044,7 @@ InitWritableChannel( info->ubuf[i] = zdecode(info->keys, crc32tab, ch); } info->numBytes = len; - } - else { + } else { /* * Simple stored data. Copy into our working buffer. */ @@ -5558,8 +5555,7 @@ ZipFSMatchInDirectoryProc( } wanted &= (TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE | TCL_GLOB_TYPE_MOUNT); - } - else { + } else { wanted = TCL_GLOB_TYPE_DIR | TCL_GLOB_TYPE_FILE; } diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index c49df55..6158c99 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -164,10 +164,9 @@ Tcl_AppInit( #define INITFILENAME ".tclshrc" #endif - (void)Tcl_EvalEx(interp, - "set tcl_rcFileName [file tildeexpand ~/" INITFILENAME "]", - -1, - TCL_EVAL_GLOBAL); + (void) Tcl_EvalEx(interp, + "set tcl_rcFileName [file tildeexpand ~/" INITFILENAME "]", + -1, TCL_EVAL_GLOBAL); return TCL_OK; } diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index feabfa8..252c493 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -1115,12 +1115,12 @@ NotifierThreadProc( tspecPtr->tv_nsec = timePtr->tv_usec * 1000; } ret = pselect(numFdBits, &readableMask, &writableMask, - &exceptionMask, tspecPtr, ¬ifierSigMask); + &exceptionMask, tspecPtr, ¬ifierSigMask); } #else pthread_sigmask(SIG_SETMASK, ¬ifierSigMask, NULL); ret = select(numFdBits, &readableMask, &writableMask, &exceptionMask, - timePtr); + timePtr); pthread_sigmask(SIG_BLOCK, &allSigMask, NULL); #endif diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 3eee59e..08b9d27 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -484,8 +484,7 @@ DoCopyFile( char linkBuf[MAXPATHLEN+1]; int length; - length = readlink(src, linkBuf, MAXPATHLEN); - /* INTL: Native. */ + length = readlink(src, linkBuf, MAXPATHLEN); /* INTL: Native. */ if (length == -1) { return TCL_ERROR; } @@ -1786,7 +1785,7 @@ GetModeFromPermString( newMode = 0; for (i = 0; i < 9; i++) { - switch (*(modeStringPtr+i)) { + switch (modeStringPtr[i]) { case 'r': if ((i%3) != 0) { goto chmodStyleCheck; @@ -1848,13 +1847,13 @@ GetModeFromPermString( * We now check for an "ugoa+-=rwxst" style permissions string */ - for (n = 0 ; *(modeStringPtr+n) != '\0' ; n = n + i) { + for (n = 0 ; modeStringPtr[n] != '\0' ; n += i) { oldMode = *modePtr; who = op = what = op_found = who_found = 0; - for (i = 0 ; *(modeStringPtr+n+i) != '\0' ; i++ ) { + for (i = 0 ; modeStringPtr[n + i] != '\0' ; i++ ) { if (!who_found) { /* who */ - switch (*(modeStringPtr+n+i)) { + switch (modeStringPtr[n + i]) { case 'u': who |= 0x9C0; continue; @@ -1875,7 +1874,7 @@ GetModeFromPermString( } if (!op_found) { /* op */ - switch (*(modeStringPtr+n+i)) { + switch (modeStringPtr[n + i]) { case '+': op = 1; op_found = 1; @@ -1893,7 +1892,7 @@ GetModeFromPermString( } } /* what */ - switch (*(modeStringPtr+n+i)) { + switch (modeStringPtr[n + i]) { case 'r': what |= 0x124; continue; @@ -1914,7 +1913,7 @@ GetModeFromPermString( default: return TCL_ERROR; } - if (*(modeStringPtr+n+i) == ',') { + if (modeStringPtr[n + i] == ',') { i++; break; } diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 70924f8..444c73f 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -131,9 +131,9 @@ TclpFindExecutable( && S_ISREG(statBuf.st_mode)) { goto gotName; } - if (*p == '\0') { + if (p[0] == '\0') { break; - } else if (*(p+1) == 0) { + } else if (p[1] == 0) { p = "./"; } else { p++; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index eb8fa4c..67bff10 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -53,31 +53,31 @@ static const char *const processors[NUMPROCESSORS] = { }; typedef struct { - union { - unsigned int dwOemId; - struct { - int wProcessorArchitecture; - int wReserved; + union { + unsigned int dwOemId; + struct { + int wProcessorArchitecture; + int wReserved; + }; }; - }; - unsigned int dwPageSize; - void *lpMinimumApplicationAddress; - void *lpMaximumApplicationAddress; - void *dwActiveProcessorMask; - unsigned int dwNumberOfProcessors; - unsigned int dwProcessorType; - unsigned int dwAllocationGranularity; - int wProcessorLevel; - int wProcessorRevision; + unsigned int dwPageSize; + void *lpMinimumApplicationAddress; + void *lpMaximumApplicationAddress; + void *dwActiveProcessorMask; + unsigned int dwNumberOfProcessors; + unsigned int dwProcessorType; + unsigned int dwAllocationGranularity; + int wProcessorLevel; + int wProcessorRevision; } SYSTEM_INFO; typedef struct { - unsigned int dwOSVersionInfoSize; - unsigned int dwMajorVersion; - unsigned int dwMinorVersion; - unsigned int dwBuildNumber; - unsigned int dwPlatformId; - wchar_t szCSDVersion[128]; + unsigned int dwOSVersionInfoSize; + unsigned int dwMajorVersion; + unsigned int dwMinorVersion; + unsigned int dwBuildNumber; + unsigned int dwPlatformId; + wchar_t szCSDVersion[128]; } OSVERSIONINFOW; #endif @@ -864,6 +864,7 @@ TclpSetVariables( /* Some platforms build configure scripts expect ~ expansion so do that */ Tcl_Obj *origPaths; Tcl_Obj *resolvedPaths; + origPaths = Tcl_GetVar2Ex(interp, "tcl_pkgPath", NULL, TCL_GLOBAL_ONLY); resolvedPaths = TclResolveTildePathList(origPaths); if (resolvedPaths != origPaths && resolvedPaths != NULL) { diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 64dd8baf..939ec85 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -524,12 +524,11 @@ TclpCreateProcess( sigdelset(&sigs, SIGKILL); sigdelset(&sigs, SIGSTOP); - posix_spawnattr_setflags(&attr, - POSIX_SPAWN_SETSIGDEF + posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF #ifdef POSIX_SPAWN_USEVFORK - | POSIX_SPAWN_USEVFORK + | POSIX_SPAWN_USEVFORK #endif - ); + ); posix_spawnattr_setsigdefault(&attr, &sigs); posix_spawn_file_actions_adddup2(&actions, GetFd(inputFile), 0); @@ -537,7 +536,7 @@ TclpCreateProcess( posix_spawn_file_actions_adddup2(&actions, GetFd(errorFile), 2); status = posix_spawnp(&pid, newArgv[0], &actions, &attr, - newArgv, environ); + newArgv, environ); childErrno = errno; posix_spawn_file_actions_destroy(&actions); posix_spawnattr_destroy(&attr); diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 8fad88a..339d61e 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -216,9 +216,8 @@ Tcl_AppInit( */ (void)Tcl_EvalEx(interp, - "set tcl_rcFileName [file tildeexpand ~/tclshrc.tcl]", - -1, - TCL_EVAL_GLOBAL); + "set tcl_rcFileName [file tildeexpand ~/tclshrc.tcl]", + TCL_AUTO_LENGTH, TCL_EVAL_GLOBAL); return TCL_OK; } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index fd28ca5..d572628 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -3092,7 +3092,7 @@ TclNativeCreateNativeRep( wp = nativePathPtr = (WCHAR *)Tcl_Alloc((len + 6) * sizeof(WCHAR)); if (nativePathPtr==0) { - goto done; + goto done; } MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len + 2); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 67a96de..16efd6a 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -2124,8 +2124,7 @@ PipeClose2Proc( TCL_READABLE); Tcl_Free(filePtr); Tcl_SetChannelOption(NULL, errChan, "-profile", "replace"); - } - else { + } else { errChan = NULL; } diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 17b6004..2d083bb 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2356,9 +2356,9 @@ TcpAccept( if (statePtr->acceptProc != NULL) { getnameinfo(&(addr.sa), len, host, sizeof(host), port, sizeof(port), - NI_NUMERICHOST|NI_NUMERICSERV); + NI_NUMERICHOST|NI_NUMERICSERV); statePtr->acceptProc(statePtr->acceptProcData, newInfoPtr->channel, - host, atoi(port)); + host, atoi(port)); } } diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 999c5ba..1a6a3db 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -582,14 +582,9 @@ TestplatformChmod( * to remove inherited ACL (we need to overwrite the default ACL's in this case) */ - if (SetNamedSecurityInfoA((LPSTR)nativePath, - SE_FILE_OBJECT, - DACL_SECURITY_INFORMATION | - PROTECTED_DACL_SECURITY_INFORMATION, - NULL, - NULL, - newAcl, - NULL) == ERROR_SUCCESS) { + if (SetNamedSecurityInfoA((LPSTR)nativePath, SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, + NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) { res = 0; } @@ -613,8 +608,6 @@ TestplatformChmod( /* Run normal chmod command */ return chmod(nativePath, pmode); - - } /* diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 84a0eca..01db9f3 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -203,12 +203,12 @@ int TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */ - void *clientData, /* The one argument to Main(). */ - size_t stackSize, /* Size of stack for the new thread. */ + void *clientData, /* The one argument to Main(). */ + size_t stackSize, /* Size of stack for the new thread. */ int flags) /* Flags controlling behaviour of the new * thread. */ { - WinThread *winThreadPtr; /* Per-thread startup info */ + WinThread *winThreadPtr; /* Per-thread startup info */ HANDLE tHandle; winThreadPtr = (WinThread *)Tcl_Alloc(sizeof(WinThread)); @@ -219,8 +219,7 @@ TclpThreadCreate( EnterCriticalSection(&joinLock); *idPtr = 0; /* must initialize as Tcl_Thread is a pointer and - * on WIN64 sizeof void* != sizeof unsigned - */ + * on WIN64 sizeof void* != sizeof unsigned */ #if defined(_MSC_VER) || defined(__MSVCRT__) tHandle = (HANDLE) _beginthreadex(NULL, (unsigned)stackSize, -- cgit v0.12