summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.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/tclVar.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/tclVar.c')
-rw-r--r--generic/tclVar.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 6ad657f..9b2a11b 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.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: tclVar.c,v 1.197 2010/02/24 10:32:17 dkf Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.198 2010/03/05 14:34:04 dkf Exp $
*/
#include "tclInt.h"
@@ -2445,7 +2445,7 @@ UnsetVarStruct(
if (traced) {
VarTrace *tracePtr = NULL;
- Tcl_HashEntry *tPtr = NULL;
+ Tcl_HashEntry *tPtr;
if (TclIsVarTraced(&dummyVar)) {
/*
@@ -2454,9 +2454,8 @@ UnsetVarStruct(
*/
int isNew;
- Tcl_HashEntry *tPtr =
- Tcl_FindHashEntry(&iPtr->varTraces, (char *) varPtr);
+ tPtr = Tcl_FindHashEntry(&iPtr->varTraces, (char *) varPtr);
tracePtr = Tcl_GetHashValue(tPtr);
varPtr->flags &= ~VAR_ALL_TRACES;
Tcl_DeleteHashEntry(tPtr);
@@ -2464,8 +2463,6 @@ UnsetVarStruct(
tPtr = Tcl_CreateHashEntry(&iPtr->varTraces,
(char *) &dummyVar, &isNew);
Tcl_SetHashValue(tPtr, tracePtr);
- } else {
- tPtr = NULL;
}
}
@@ -2484,12 +2481,12 @@ UnsetVarStruct(
tracePtr = NULL;
if (TclIsVarTraced(&dummyVar)) {
- tPtr = Tcl_FindHashEntry(&iPtr->varTraces, (char *) &dummyVar);
+ tPtr = Tcl_FindHashEntry(&iPtr->varTraces,
+ (char *) &dummyVar);
tracePtr = Tcl_GetHashValue(tPtr);
- }
-
- if (tPtr) {
- Tcl_DeleteHashEntry(tPtr);
+ if (tPtr) {
+ Tcl_DeleteHashEntry(tPtr);
+ }
}
}