| author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
| commit | b501910778714de837dc4367698256e996737e9b (patch) | |
| tree | f2dc6d4861ea238a538f41c4306249dad1ac3ea5 | |
| parent | f7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff) | |
| download | tcl-b501910778714de837dc4367698256e996737e9b.zip tcl-b501910778714de837dc4367698256e996737e9b.tar.gz tcl-b501910778714de837dc4367698256e996737e9b.tar.bz2 | |
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fde9b1b..b9282ae 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.447 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.448 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -1310,6 +1310,7 @@ DeleteInterpProc( Tcl_HashSearch search; Tcl_HashTable *hTablePtr; ResolverScheme *resPtr, *nextResPtr; + int i; /* * Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup. @@ -1503,89 +1504,87 @@ DeleteInterpProc( * contents. */ - { - Tcl_HashEntry *hPtr; - Tcl_HashSearch hSearch; - int i; - - for (hPtr = Tcl_FirstHashEntry(iPtr->linePBodyPtr, &hSearch); - hPtr != NULL; - hPtr = Tcl_NextHashEntry(&hSearch)) { - CmdFrame *cfPtr = Tcl_GetHashValue(hPtr); + for (hPtr = Tcl_FirstHashEntry(iPtr->linePBodyPtr, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + CmdFrame *cfPtr = Tcl_GetHashValue(hPtr); - if (cfPtr->type == TCL_LOCATION_SOURCE) { - Tcl_DecrRefCount(cfPtr->data.eval.path); - } - ckfree((char *) cfPtr->line); - ckfree((char *) cfPtr); - Tcl_DeleteHashEntry(hPtr); + if (cfPtr->type == TCL_LOCATION_SOURCE) { + Tcl_DecrRefCount(cfPtr->data.eval.path); } - Tcl_DeleteHashTable(iPtr->linePBodyPtr); - ckfree((char *) iPtr->linePBodyPtr); - iPtr->linePBodyPtr = NULL; + ckfree((char *) cfPtr->line); + ckfree((char *) cfPtr); + Tcl_DeleteHashEntry(hPtr); + } + Tcl_DeleteHashTable(iPtr->linePBodyPtr); + ckfree((char *) iPtr->linePBodyPtr); + iPtr->linePBodyPtr = NULL; - /* - * See also tclCompile.c, TclCleanupByteCode - */ + /* + * See also tclCompile.c, TclCleanupByteCode + */ - for (hPtr = Tcl_FirstHashEntry(iPtr->lineBCPtr, &hSearch); - hPtr != NULL; - hPtr = Tcl_NextHashEntry(&hSearch)) { - ExtCmdLoc *eclPtr = Tcl_GetHashValue(hPtr); + for (hPtr = Tcl_FirstHashEntry(iPtr->lineBCPtr, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + ExtCmdLoc *eclPtr = Tcl_GetHashValue(hPtr); - if (eclPtr->type == TCL_LOCATION_SOURCE) { - Tcl_DecrRefCount(eclPtr->path); - } - for (i=0; i< eclPtr->nuloc; i++) { - ckfree((char *) eclPtr->loc[i].line); - } + if (eclPtr->type == TCL_LOCATION_SOURCE) { + Tcl_DecrRefCount(eclPtr->path); + } + for (i=0; i< eclPtr->nuloc; i++) { + ckfree((char *) eclPtr->loc[i].line); + } - if (eclPtr->loc != NULL) { - ckfree((char *) eclPtr->loc); - } + if (eclPtr->loc != NULL) { + ckfree((char *) eclPtr->loc); + } - Tcl_DeleteHashTable(&eclPtr->litInfo); + Tcl_DeleteHashTable(&eclPtr->litInfo); - ckfree((char *) eclPtr); - Tcl_DeleteHashEntry(hPtr); - } - Tcl_DeleteHashTable(iPtr->lineBCPtr); - ckfree((char *) iPtr->lineBCPtr); - iPtr->lineBCPtr = NULL; + ckfree((char *) eclPtr); + Tcl_DeleteHashEntry(hPtr); + } + Tcl_DeleteHashTable(iPtr->lineBCPtr); + ckfree((char *) iPtr->lineBCPtr); + iPtr->lineBCPtr = NULL; + + /* + * Location stack for uplevel/eval/... scripts which were passed through + * proc arguments. Actually we track all arguments as we do not and cannot + * know which arguments will be used as scripts and which will not. + */ + if (iPtr->lineLAPtr->numEntries) { /* - * Location stack for uplevel/eval/... scripts which were passed - * through proc arguments. Actually we track all arguments as we do - * not and cannot know which arguments will be used as scripts and - * which will not. + * When the interp goes away we have nothing on the stack, so there + * are no arguments, so this table has to be empty. */ - if (iPtr->lineLAPtr->numEntries) { - /* - * When the interp goes away we have nothing on the stack, so - * there are no arguments, so this table has to be empty. - */ + Tcl_Panic("Argument location tracking table not empty"); + } - Tcl_Panic("Argument location tracking table not empty"); - } + Tcl_DeleteHashTable(iPtr->lineLAPtr); + ckfree((char *) iPtr->lineLAPtr); + iPtr->lineLAPtr = NULL; - Tcl_DeleteHashTable(iPtr->lineLAPtr); - ckfree((char *) iPtr->lineLAPtr); - iPtr->lineLAPtr = NULL; + if (iPtr->lineLABCPtr->numEntries) { + /* + * When the interp goes away we have nothing on the stack, so there + * are no arguments, so this table has to be empty. + */ - if (iPtr->lineLABCPtr->numEntries) { - /* - * When the interp goes away we have nothing on the stack, so - * there are no arguments, so this table has to be empty. - */ + Tcl_Panic("Argument location tracking table not empty"); + } - Tcl_Panic("Argument location tracking table not empty"); - } + Tcl_DeleteHashTable(iPtr->lineLABCPtr); + ckfree((char *) iPtr->lineLABCPtr); + iPtr->lineLABCPtr = NULL; - Tcl_DeleteHashTable(iPtr->lineLABCPtr); - ckfree((char *) iPtr->lineLABCPtr); - iPtr->lineLABCPtr = NULL; - } + /* + * Squelch the tables of traces on variables and searches over arrays in + * the in the interpreter. + */ Tcl_DeleteHashTable(&iPtr->varTraces); Tcl_DeleteHashTable(&iPtr->varSearches); @@ -7423,12 +7422,17 @@ ExprAbsFunc( goto unChanged; } else if (l == (long)0) { const char *string = objv[1]->bytes; + if (!string) { - /* There is no string representation, so internal one is correct */ + /* + * There is no string representation, so internal one is + * correct. + */ + goto unChanged; } while (isspace(UCHAR(*string))) { - ++string; + string++; } if (*string != '-') { goto unChanged; @@ -7927,7 +7931,7 @@ MathFuncWrongNumArgs( const char *tail = name + strlen(name); while (tail > name+1) { - --tail; + tail--; if (*tail == ':' && tail[-1] == ':') { name = tail+1; break; diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 042cbed..62f8f46 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBinary.c,v 1.59 2009/12/29 01:43:23 patthoyts Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.60 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -1303,7 +1303,6 @@ BinaryScanCmd( case 'H': { char *dest; unsigned char *src; - int i; static const char hexdigit[] = "0123456789abcdef"; if (arg >= objc) { @@ -2303,13 +2302,15 @@ BinaryDecodeHex( value |= (c & 0xf); } else { value <<= 4; - ++cut; + cut++; } } *cursor++ = UCHAR(value); value = 0; } - if (cut > size) cut = size; + if (cut > size) { + cut = size; + } Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2344,7 +2345,7 @@ BinaryDecodeHex( #define OUTPUT(c) \ do { \ *cursor++ = (c); \ - ++outindex; \ + outindex++; \ if (maxlen > 0 && cursor != limit) { \ if (outindex == maxlen) { \ memcpy(cursor, wrapchar, wrapcharlen); \ @@ -2505,10 +2506,12 @@ BinaryDecodeUu( continue; } } else { - ++cut; + cut++; } } - if (cut>3) cut=3; + if (cut > 3) { + cut = 3; + } *cursor++ = (((d[0] - 0x20) & 0x3f) << 2) | (((d[1] - 0x20) & 0x3f) >> 4); *cursor++ = (((d[1] - 0x20) & 0x3f) << 4) @@ -2516,7 +2519,9 @@ BinaryDecodeUu( *cursor++ = (((d[2] - 0x20) & 0x3f) << 6) | (((d[3] - 0x20) & 0x3f)); } - if (cut > size) cut = size; + if (cut > size) { + cut = size; + } Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2584,7 +2589,6 @@ BinaryDecode64( size = ((count + 3) & ~3) * 3 / 4; begin = cursor = Tcl_SetByteArrayLength(resultObj, size); while (data < dataend) { - int i; unsigned long value = 0; for (i=0 ; i<4 ; i++) { @@ -2604,7 +2608,7 @@ BinaryDecode64( } else if (c == '=') { value <<= 6; if (cut < 2) { - ++cut; + cut++; } } else { if (strict || !isspace(c)) { @@ -2615,14 +2619,16 @@ BinaryDecode64( } } else { value <<= 6; - ++cut; + cut++; } } *cursor++ = UCHAR((value >> 16) & 0xff); *cursor++ = UCHAR((value >> 8) & 0xff); *cursor++ = UCHAR(value & 0xff); } - if (cut > size) cut = size; + if (cut > size) { + cut = size; + } Tcl_SetByteArrayLength(resultObj, cursor - begin - cut); Tcl_SetObjResult(interp, resultObj); return TCL_OK; diff --git a/generic/tclClock.c b/generic/tclClock.c index 6c87db0..7519da8 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.74 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.75 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -796,8 +796,7 @@ ConvertLocalToUTCUsingTable( if (nHave == 8) { Tcl_Panic("loop in ConvertLocalToUTCUsingTable"); } - have[nHave] = fields->tzOffset; - ++nHave; + have[nHave++] = fields->tzOffset; } fields->seconds = fields->localSeconds - fields->tzOffset; } @@ -844,7 +843,7 @@ ConvertLocalToUTCUsingC( secondOfDay = (int)(jsec % SECONDS_PER_DAY); if (secondOfDay < 0) { secondOfDay += SECONDS_PER_DAY; - --fields->julianDay; + fields->julianDay--; } GetGregorianEraYearDay(fields, changeover); GetMonthDay(fields); @@ -1257,7 +1256,7 @@ GetGregorianEraYearDay( day %= FOUR_CENTURIES; if (day < 0) { day += FOUR_CENTURIES; - --n; + n--; } year += 400 * n; @@ -1295,7 +1294,7 @@ GetGregorianEraYearDay( day %= FOUR_YEARS; if (day < 0) { day += FOUR_YEARS; - --n; + n--; } year += 4 * n; @@ -1476,15 +1475,15 @@ GetJulianDayFromEraYearMonthDay( ym1o4 = ym1 / 4; if (ym1 % 4 < 0) { - --ym1o4; + ym1o4--; } ym1o100 = ym1 / 100; if (ym1 % 100 < 0) { - --ym1o100; + ym1o100--; } ym1o400 = ym1 / 400; if (ym1 % 400 < 0) { - --ym1o400; + ym1o400--; } fields->julianDay = JDAY_1_JAN_1_CE_GREGORIAN - 1 + fields->dayOfMonth @@ -2022,7 +2021,7 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - --data->refCount; + data->refCount--; if (data->refCount == 0) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 4edfdec..6456bd5 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.123 2009/12/28 12:55:48 dkf Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.124 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -1121,7 +1121,6 @@ Tcl_FileObjCmd( } case FCMD_LINK: { Tcl_Obj *contents; - int index; if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "?-linktype? linkname ?target?"); diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 85f9696..d063014 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.179 2010/02/28 21:15:11 dkf Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.180 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -3610,7 +3610,7 @@ Tcl_LsortObjCmd( sortInfo.isIncreasing = 1; break; case LSORT_INDEX: { - Tcl_Obj **indices; + Tcl_Obj **indexv; /* === START SPECIAL CASE === * @@ -3634,7 +3634,7 @@ Tcl_LsortObjCmd( */ if (TclListObjGetElements(interp, objv[i+1], &sortInfo.indexc, - &indices) != TCL_OK) { + &indexv) != TCL_OK) { return TCL_ERROR; } /* === END SPECIAL CASE === */ @@ -3661,7 +3661,7 @@ Tcl_LsortObjCmd( */ for (j=0 ; j<sortInfo.indexc ; j++) { - if (TclGetIntForIndexM(interp, indices[j], SORTIDX_END, + if (TclGetIntForIndexM(interp, indexv[j], SORTIDX_END, &sortInfo.indexv[j]) != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (-index option item number %d)", j)); @@ -3922,7 +3922,6 @@ Tcl_LsortObjCmd( if (sortInfo.resultCode == TCL_OK) { List *listRepPtr; Tcl_Obj **newArray, *objPtr; - int i; resultPtr = Tcl_NewListObj(sortInfo.numElements * groupSize, NULL); listRepPtr = resultPtr->internalRep.twoPtrValue.ptr1; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 84fbe1b..eb6bb7f 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.203 2010/03/02 08:47:35 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.204 2010/03/05 14:34:03 dkf Exp $ */ #include "tclInt.h" @@ -2513,7 +2513,7 @@ StringEqualCmd( if (i+1 >= objc-2) { goto str_cmp_args; } - ++i; + i++; if (TclGetIntFromObj(interp, objv[i], &reqlength) != TCL_OK) { return TCL_ERROR; } @@ -2660,7 +2660,7 @@ StringCmpCmd( if (i+1 >= objc-2) { goto str_cmp_args; } - ++i; + i++; if (TclGetIntFromObj(interp, objv[i], &reqlength) != TCL_OK) { return TCL_ERROR; } @@ -3927,7 +3927,7 @@ TclNRSwitchObjCmd( static int SwitchPostProc( ClientData data[], /* Data passed from Tcl_NRAddCallback above */ - Tcl_Interp* interp, /* Tcl interpreter */ + Tcl_Interp *interp, /* Tcl interpreter */ int result) /* Result to return*/ { /* Unpack the preserved data */ diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c |