summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-06-08 18:52:01 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-06-08 18:52:01 (GMT)
commit95199c5bd3068d26758129488d106f3c88f67fb6 (patch)
tree86c11f5813dbd63f36dde306011a2033c31bf523
parent8faa7d16a6d0a767179b62646edb7547308aac64 (diff)
downloadtcl-95199c5bd3068d26758129488d106f3c88f67fb6.zip
tcl-95199c5bd3068d26758129488d106f3c88f67fb6.tar.gz
tcl-95199c5bd3068d26758129488d106f3c88f67fb6.tar.bz2
Fix variable usage warning. [Bug 969068]
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclHash.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index f55fd7c..72bb395 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-08 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tclHash.c (RebuildTable): Move declaration of variable
+ so it is only declared when it is used. [Bug 969068]
+
2004-06-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
* doc/lsearch.n: Added correct option to example. [Bug 968219]
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 360acfe..952d6df 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.19 2004/05/27 13:18:53 dkf Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.20 2004/06/08 18:52:02 dkf Exp $
*/
#include "tclInt.h"
@@ -1147,7 +1147,6 @@ RebuildTable(tablePtr)
register Tcl_HashEntry **oldChainPtr, **newChainPtr;
register Tcl_HashEntry *hPtr;
Tcl_HashKeyType *typePtr;
- VOID *key;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
@@ -1195,9 +1194,6 @@ RebuildTable(tablePtr)
for (oldChainPtr = oldBuckets; oldSize > 0; oldSize--, oldChainPtr++) {
for (hPtr = *oldChainPtr; hPtr != NULL; hPtr = *oldChainPtr) {
*oldChainPtr = hPtr->nextPtr;
-
- key = (VOID *) Tcl_GetHashKey (tablePtr, hPtr);
-
#if TCL_HASH_KEY_STORE_HASH
if (typePtr->hashKeyProc == NULL
|| typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
@@ -1208,6 +1204,8 @@ RebuildTable(tablePtr)
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
#else
+ VOID *key = (VOID *) Tcl_GetHashKey (tablePtr, hPtr);
+
if (typePtr->hashKeyProc) {
unsigned int hash;
hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);