diff options
author | dkf <dkf@noemail.net> | 2010-03-05 14:34:02 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2010-03-05 14:34:02 (GMT) |
commit | 0beea22f470575ca4033d1d218b40cac85372822 (patch) | |
tree | f2dc6d4861ea238a538f41c4306249dad1ac3ea5 /generic/tclClock.c | |
parent | 5ba7e23db54042b3bb546b0d227da32adcde8a1a (diff) | |
download | tcl-0beea22f470575ca4033d1d218b40cac85372822.zip tcl-0beea22f470575ca4033d1d218b40cac85372822.tar.gz tcl-0beea22f470575ca4033d1d218b40cac85372822.tar.bz2 |
Code Audit results:
* use do { ... } while (0) in macros
* avoid shadowing one local variable with another
* use clearer 'foo.bar++;' instead of '++foo.bar;' where result not
required (i.e., semantically equivalent)
* follow Engineering Manual rules on spacing and declarations
FossilOrigin-Name: 4d8a4f639d28df5b5dfabd407be8efbb44454601
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r-- | generic/tclClock.c | 19 |
1 files changed, 9 insertions, 10 deletions
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]); |