From 9c396b2aea2acea7ec6cca8a133b2434259eea5c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Jul 2019 06:47:52 +0000 Subject: Eliminate the use of C++ keywords as variable names. Nothing more than rename the variables in something else. --- generic/tclBasic.c | 10 ++++---- generic/tclLiteral.c | 4 ++-- generic/tclOODefineCmds.c | 6 ++--- generic/tclOOInfo.c | 12 +++++----- generic/tclPkg.c | 6 ++--- generic/tclProc.c | 4 ++-- generic/tclResult.c | 8 +++---- generic/tclStringObj.c | 56 ++++++++++++++++++++++---------------------- generic/tclTestProcBodyObj.c | 8 +++---- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 78b9f0c..f3a75bb 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2643,7 +2643,7 @@ TclCreateObjCommandInNs( Tcl_Interp *interp, const char *cmdName, /* Name of command, without any namespace * components. */ - Tcl_Namespace *namespace, /* The namespace to create the command in */ + Tcl_Namespace *namesp, /* The namespace to create the command in */ Tcl_ObjCmdProc *proc, /* Object-based function to associate with * name. */ ClientData clientData, /* Arbitrary value to pass to object @@ -2657,7 +2657,7 @@ TclCreateObjCommandInNs( ImportRef *oldRefPtr = NULL; ImportedCmdData *dataPtr; Tcl_HashEntry *hPtr; - Namespace *nsPtr = (Namespace *) namespace; + Namespace *nsPtr = (Namespace *) namesp; /* * If the command name we seek to create already exists, we need to delete @@ -5967,7 +5967,7 @@ TclArgumentEnter( CmdFrame *cfPtr) { Interp *iPtr = (Interp *) interp; - int new, i; + int isNew, i; Tcl_HashEntry *hPtr; CFWord *cfwPtr; @@ -5983,8 +5983,8 @@ TclArgumentEnter( if (cfPtr->line[i] < 0) { continue; } - hPtr = Tcl_CreateHashEntry(iPtr->lineLAPtr, objv[i], &new); - if (new) { + hPtr = Tcl_CreateHashEntry(iPtr->lineLAPtr, objv[i], &isNew); + if (isNew) { /* * The word is not on the stack yet, remember the current location * and initialize references. diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 2f93200..946c753 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -408,7 +408,7 @@ TclRegisterLiteral( Tcl_Obj *objPtr; unsigned hash; unsigned int localHash; - int objIndex, new; + int objIndex, isNew; Namespace *nsPtr; if (length < 0) { @@ -462,7 +462,7 @@ TclRegisterLiteral( */ globalPtr = NULL; - objPtr = TclCreateLiteral(iPtr, bytes, length, hash, &new, nsPtr, flags, + objPtr = TclCreateLiteral(iPtr, bytes, length, hash, &isNew, nsPtr, flags, &globalPtr); objIndex = AddLocalLiteralEntry(envPtr, objPtr, localHash); diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 6a00018..fb16007 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1244,7 +1244,7 @@ TclOODefineSelfObjCmd( { Tcl_Namespace *nsPtr; Object *oPtr; - int result, private; + int result, isPrivate; oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { @@ -1256,7 +1256,7 @@ TclOODefineSelfObjCmd( return TCL_OK; } - private = IsPrivateDefine(interp); + isPrivate = IsPrivateDefine(interp); /* * Make the oo::objdefine namespace the current namespace and evaluate the @@ -1267,7 +1267,7 @@ TclOODefineSelfObjCmd( if (InitDefineContext(interp, nsPtr, oPtr, objc, objv) != TCL_OK) { return TCL_ERROR; } - if (private) { + if (isPrivate) { ((Interp *) interp)->varFramePtr->isProcCallFrame = PRIVATE_FRAME; } diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index fefeb0f..99918ae 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -809,7 +809,7 @@ InfoObjectVariablesCmd( { Object *oPtr; Tcl_Obj *resultObj; - int i, private = 0; + int i, isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?"); @@ -819,7 +819,7 @@ InfoObjectVariablesCmd( if (strcmp("-private", Tcl_GetString(objv[2])) != 0) { return TCL_ERROR; } - private = 1; + isPrivate = 1; } oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[1]); if (oPtr == NULL) { @@ -827,7 +827,7 @@ InfoObjectVariablesCmd( } resultObj = Tcl_NewObj(); - if (private) { + if (isPrivate) { PrivateVariableMapping *privatePtr; FOREACH_STRUCT(privatePtr, oPtr->privateVariables) { @@ -1588,7 +1588,7 @@ InfoClassVariablesCmd( { Class *clsPtr; Tcl_Obj *resultObj; - int i, private = 0; + int i, isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?"); @@ -1598,7 +1598,7 @@ InfoClassVariablesCmd( if (strcmp("-private", Tcl_GetString(objv[2])) != 0) { return TCL_ERROR; } - private = 1; + isPrivate = 1; } clsPtr = GetClassFromObj(interp, objv[1]); if (clsPtr == NULL) { @@ -1606,7 +1606,7 @@ InfoClassVariablesCmd( } resultObj = Tcl_NewObj(); - if (private) { + if (isPrivate) { PrivateVariableMapping *privatePtr; FOREACH_STRUCT(privatePtr, clsPtr->privateVariables) { diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ed5c57a..6727715 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -280,11 +280,11 @@ TclPkgFileSeen( if (pkgFiles && pkgFiles->names) { const char *name = pkgFiles->names->name; Tcl_HashTable *table = &pkgFiles->table; - int new; - Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &new); + int isNew; + Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &isNew); Tcl_Obj *list; - if (new) { + if (isNew) { list = Tcl_NewObj(); Tcl_SetHashValue(entry, list); Tcl_IncrRefCount(list); diff --git a/generic/tclProc.c b/generic/tclProc.c index afa00ee..63def3a 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1300,7 +1300,7 @@ InitLocalCache( Var *varPtr; LocalCache *localCachePtr; CompiledLocal *localPtr; - int new; + int isNew; ByteCodeGetIntRep(procPtr->bodyPtr, &tclByteCodeType, codePtr); @@ -1323,7 +1323,7 @@ InitLocalCache( } else { *namePtr = TclCreateLiteral(iPtr, localPtr->name, localPtr->nameLength, /* hash */ (unsigned int) -1, - &new, /* nsPtr */ NULL, 0, NULL); + &isNew, /* nsPtr */ NULL, 0, NULL); Tcl_IncrRefCount(*namePtr); } diff --git a/generic/tclResult.c b/generic/tclResult.c index 4d14f01..6e9d4a6 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -832,19 +832,19 @@ SetupAppendBuffer( totalSpace = newSpace + iPtr->appendUsed; if (totalSpace >= iPtr->appendAvl) { - char *new; + char *newSpace; if (totalSpace < 100) { totalSpace = 200; } else { totalSpace *= 2; } - new = ckalloc(totalSpace); - strcpy(new, iPtr->result); + newSpace = ckalloc(totalSpace); + strcpy(newSpace, iPtr->result); if (iPtr->appendResult != NULL) { ckfree(iPtr->appendResult); } - iPtr->appendResult = new; + iPtr->appendResult = newSpace; iPtr->appendAvl = totalSpace; } else if (iPtr->result != iPtr->appendResult) { strcpy(iPtr->appendResult, iPtr->result); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 547ece1..ce687c6 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3563,7 +3563,7 @@ TclStringFirst( } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *end, *try, *bh; + unsigned char *end, *check, *bh; unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); /* Find bytes in bytes */ @@ -3574,25 +3574,25 @@ TclStringFirst( } end = bh + lh; - try = bh + start; - while (try + ln <= end) { + check = bh + start; + while (check + ln <= end) { /* * Look for the leading byte of the needle in the haystack - * starting at try and stopping when there's not enough room + * starting at check and stopping when there's not enough room * for the needle left. */ - try = memchr(try, bn[0], (end + 1 - ln) - try); - if (try == NULL) { + check = memchr(check, bn[0], (end + 1 - ln) - check); + if (check == NULL) { /* Leading byte not found -> needle cannot be found. */ return -1; } /* Leading byte found, check rest of needle. */ - if (0 == memcmp(try+1, bn+1, ln-1)) { + if (0 == memcmp(check+1, bn+1, ln-1)) { /* Checks! Return the successful index. */ - return (try - bh); + return (check - bh); } /* Rest of needle match failed; Iterate to continue search. */ - try++; + check++; } return -1; } @@ -3610,7 +3610,7 @@ TclStringFirst( */ { - Tcl_UniChar *try, *end, *uh; + Tcl_UniChar *check, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); uh = Tcl_GetUnicodeFromObj(haystack, &lh); @@ -3620,10 +3620,10 @@ TclStringFirst( } end = uh + lh; - for (try = uh + start; try + ln <= end; try++) { - if ((*try == *un) && (0 == - memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { - return (try - uh); + for (check = uh + start; check + ln <= end; check++) { + if ((*check == *un) && (0 == + memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { + return (check - uh); } } return -1; @@ -3667,7 +3667,7 @@ TclStringLast( } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *try, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); + unsigned char *check, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); if (last >= lh) { @@ -3677,20 +3677,20 @@ TclStringLast( /* Don't start the loop if there cannot be a valid answer */ return -1; } - try = bh + last + 1 - ln; + check = bh + last + 1 - ln; - while (try >= bh) { - if ((*try == bn[0]) - && (0 == memcmp(try+1, bn+1, ln-1))) { - return (try - bh); + while (check >= bh) { + if ((*check == bn[0]) + && (0 == memcmp(check+1, bn+1, ln-1))) { + return (check - bh); } - try--; + check--; } return -1; } { - Tcl_UniChar *try, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); + Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); if (last >= lh) { @@ -3700,13 +3700,13 @@ TclStringLast( /* Don't start the loop if there cannot be a valid answer */ return -1; } - try = uh + last + 1 - ln; - while (try >= uh) { - if ((*try == un[0]) - && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { - return (try - uh); + check = uh + last + 1 - ln; + while (check >= uh) { + if ((*check == un[0]) + && (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + return (check - uh); } - try--; + check--; } return -1; } diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 913b253..11e841f 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -51,7 +51,7 @@ static int ProcBodyTestCheckObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe); static int RegisterCommand(Tcl_Interp* interp, - const char *namespace, const CmdTable *cmdTablePtr); + const char *namesp, const CmdTable *cmdTablePtr); /* * List of commands to create when the package is loaded; must go after the @@ -139,7 +139,7 @@ static int RegisterCommand( Tcl_Interp* interp, /* the Tcl interpreter for which the operation * is performed */ - const char *namespace, /* the namespace in which the command is + const char *namesp, /* the namespace in which the command is * registered */ const CmdTable *cmdTablePtr)/* the command to register */ { @@ -147,13 +147,13 @@ RegisterCommand( if (cmdTablePtr->exportIt) { sprintf(buf, "namespace eval %s { namespace export %s }", - namespace, cmdTablePtr->cmdName); + namesp, cmdTablePtr->cmdName); if (Tcl_EvalEx(interp, buf, -1, 0) != TCL_OK) { return TCL_ERROR; } } - sprintf(buf, "%s::%s", namespace, cmdTablePtr->cmdName); + sprintf(buf, "%s::%s", namesp, cmdTablePtr->cmdName); Tcl_CreateObjCommand(interp, buf, cmdTablePtr->proc, 0, 0); return TCL_OK; } -- cgit v0.12