From 95199c5bd3068d26758129488d106f3c88f67fb6 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 8 Jun 2004 18:52:01 +0000 Subject: Fix variable usage warning. [Bug 969068] --- ChangeLog | 5 +++++ generic/tclHash.c | 8 +++----- 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 + + * 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 * 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); -- cgit v0.12