summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-03-05 14:34:03 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-03-05 14:34:03 (GMT)
commitb501910778714de837dc4367698256e996737e9b (patch)
treef2dc6d4861ea238a538f41c4306249dad1ac3ea5 /generic/tclUtil.c
parentf7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff)
downloadtcl-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/tclUtil.c')
-rw-r--r--generic/tclUtil.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 6b054d8..71e4093 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.113 2010/02/24 10:45:04 dkf Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.114 2010/03/05 14:34:04 dkf Exp $
*/
#include "tclInt.h"
@@ -435,7 +435,7 @@ Tcl_SplitList(
if (next == '\0') {
break;
}
- ++l;
+ l++;
if (isspace(UCHAR(next))) { /* INTL: ISO space. */
continue;
}
@@ -553,7 +553,7 @@ TclMarkList(
if ((l+1) == end) {
break;
}
- ++l;
+ l++;
if (isspace(UCHAR(next))) { /* INTL: ISO space. */
continue;
}
@@ -2238,7 +2238,7 @@ Tcl_PrintDouble(
* at least TCL_DOUBLE_SPACE characters. */
{
char *p, c;
- int exp;
+ int exponent;
int signum;
char buffer[TCL_DOUBLE_SPACE];
Tcl_UniChar ch;
@@ -2279,12 +2279,12 @@ Tcl_PrintDouble(
* Ordinary (normal and denormal) values.
*/
- exp = TclDoubleDigits(buffer, value, &signum);
+ exponent = TclDoubleDigits(buffer, value, &signum);
if (signum) {
*dst++ = '-';
}
p = buffer;
- if (exp < -3 || exp > 17) {
+ if (exponent < -3 || exponent > 17) {
/*
* E format for numbers < 1e-3 or >= 1e17.
*/
@@ -2298,17 +2298,17 @@ Tcl_PrintDouble(
c = *++p;
}
}
- sprintf(dst, "e%+d", exp-1);
+ sprintf(dst, "e%+d", exponent-1);
} else {
/*
* F format for others.
*/
- if (exp <= 0) {
+ if (exponent <= 0) {
*dst++ = '0';
}
c = *p;
- while (exp-- > 0) {
+ while (exponent-- > 0) {
if (c != '\0') {
*dst++ = c;
c = *++p;
@@ -2320,7 +2320,7 @@ Tcl_PrintDouble(
if (c == '\0') {
*dst++ = '0';
} else {
- while (++exp < 0) {
+ while (++exponent < 0) {
*dst++ = '0';
}
while (c != '\0') {
@@ -2624,14 +2624,13 @@ TclGetIntForIndex(
parseError:
if (interp != NULL) {
- const char *bytes = Tcl_GetString(objPtr);
-
/*
* The result might not be empty; this resets it which should be both
* a cheap operation, and of little problem because this is an
* error-generation path anyway.
*/
+ bytes = Tcl_GetString(objPtr);
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", bytes,
"\": must be integer?[+-]integer? or end?[+-]integer?", NULL);
@@ -2820,7 +2819,7 @@ TclCheckBadOctal(
}
if (*p == '0') {
if ((p[1] == 'o') || p[1] == 'O') {
- p+=2;
+ p += 2;
}
while (isdigit(UCHAR(*p))) { /* INTL: digit. */
p++;