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/tclStrToD.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/tclStrToD.c')
-rwxr-xr-x | generic/tclStrToD.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 20016db..9577798 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.40 2010/02/24 10:32:17 dkf Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.41 2010/03/05 14:34:04 dkf Exp $ * *---------------------------------------------------------------------- */ @@ -143,7 +143,7 @@ static int n770_fp; /* Flag is 1 on Nokia N770 floating point. static double AbsoluteValue(double v, int *signum); static int AccumulateDecimalDigit(unsigned, int, Tcl_WideUInt *, mp_int *, int); -static double BignumToBiasedFrExp(mp_int *big, int* machexp); +static double BignumToBiasedFrExp(mp_int *big, int *machexp); static int GetIntegerTimesPower(double v, mp_int *r, int *e); static double MakeHighPrecisionDouble(int signum, mp_int *significand, int nSigDigs, int exponent); @@ -456,7 +456,7 @@ TclParseNumber( case ZERO_O: zeroo: if (c == '0') { - ++numTrailZeros; + numTrailZeros++; state = OCTAL; break; } else if (c >= '1' && c <= '7') { @@ -529,7 +529,7 @@ TclParseNumber( */ if (c == '0') { - ++numTrailZeros; + numTrailZeros++; state = BAD_OCTAL; break; } else if (isdigit(UCHAR(c))) { @@ -572,7 +572,7 @@ TclParseNumber( case ZERO_X: zerox: if (c == '0') { - ++numTrailZeros; + numTrailZeros++; state = HEXADECIMAL; break; } else if (isdigit(UCHAR(c))) { @@ -619,7 +619,7 @@ TclParseNumber( case ZERO_B: zerob: if (c == '0') { - ++numTrailZeros; + numTrailZeros++; state = BINARY; break; } else if (c != '1') { @@ -666,7 +666,7 @@ TclParseNumber( acceptPoint = p; acceptLen = len; if (c == '0') { - ++numTrailZeros; + numTrailZeros++; state = DECIMAL; break; } else if (isdigit(UCHAR(c))) { @@ -709,12 +709,12 @@ TclParseNumber( case LEADING_RADIX_POINT: if (c == '0') { - ++numDigitsAfterDp; - ++numTrailZeros; + numDigitsAfterDp++; + numTrailZeros++; state = FRACTION; break; } else if (isdigit(UCHAR(c))) { - ++numDigitsAfterDp; + numDigitsAfterDp++; if (objPtr != NULL) { significandOverflow = AccumulateDecimalDigit( (unsigned)(c-'0'), numTrailZeros, @@ -894,8 +894,8 @@ TclParseNumber( acceptLen = len; goto endgame; } - ++p; - --len; + p++; + len--; } endgame: @@ -921,8 +921,8 @@ TclParseNumber( */ while (len != 0 && isspace(UCHAR(*p))) { - ++p; - --len; + p++; + len--; } } if (endPtrPtr == NULL) { @@ -1924,7 +1924,7 @@ TclDoubleDigits( i = mp_cmp_mag(&temp, &s); if (i>0 || (highOK && i==0)) { mp_mul_d(&s, 10, &s); - ++k; + k++; } else { mp_mul_d(&temp, 10, &temp); i = mp_cmp_mag(&temp, &s); @@ -1932,7 +1932,7 @@ TclDoubleDigits( mp_mul_d(&r, 10, &r); mp_mul_d(&mplus, 10, &mplus); mp_mul_d(&mminus, 10, &mminus); - --k; + k--; } } @@ -1961,7 +1961,7 @@ TclDoubleDigits( if (highOK) { tc2 = (tc2 >= 0); } else { - tc2= (tc2 > 0); + tc2 = (tc2 > 0); } if (!tc1) { if (!tc2) { @@ -2206,7 +2206,7 @@ TclInitDoubleConversion(void) if (frexp((double) FLT_RADIX, &log2FLT_RADIX) != 0.5) { Tcl_Panic("This code doesn't work on a decimal machine!"); } - --log2FLT_RADIX; + log2FLT_RADIX--; mantBits = DBL_MANT_DIG * log2FLT_RADIX; d = 1.0; |