diff options
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 /generic/tclClock.c | |
parent | f7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff) | |
download | tcl-b501910778714de837dc4367698256e996737e9b.zip tcl-b501910778714de837dc4367698256e996737e9b.tar.gz tcl-b501910778714de837dc4367698256e996737e9b.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
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]); |