diff options
author | nijtmans <nijtmans@noemail.net> | 2010-08-24 06:17:55 (GMT) |
---|---|---|
committer | nijtmans <nijtmans@noemail.net> | 2010-08-24 06:17:55 (GMT) |
commit | 23f79c360e6e75b925ed0dbcdfb2c258ec23796e (patch) | |
tree | 86295f226269a67dd21e53bbcb7039ac3fb18b4e /generic/tclHash.c | |
parent | fb8576dab44774721d42d040a65e860f49b74b94 (diff) | |
download | tcl-23f79c360e6e75b925ed0dbcdfb2c258ec23796e.zip tcl-23f79c360e6e75b925ed0dbcdfb2c258ec23796e.tar.gz tcl-23f79c360e6e75b925ed0dbcdfb2c258ec23796e.tar.bz2 |
[Bug 3007895] Tcl_(Find|Create)HashEntry stub entries can never be called.
FossilOrigin-Name: 616c58cab20cc8dc8c2e3dd1459187660e1cabef
Diffstat (limited to 'generic/tclHash.c')
-rw-r--r-- | generic/tclHash.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/generic/tclHash.c b/generic/tclHash.c index 7647db0..81f9326 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.45 2010/02/25 22:20:10 nijtmans Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.46 2010/08/24 06:17:55 nijtmans Exp $ */ #include "tclInt.h" @@ -74,6 +74,9 @@ static unsigned int HashStringKey(Tcl_HashTable *tablePtr, void *keyPtr); static Tcl_HashEntry * BogusFind(Tcl_HashTable *tablePtr, const char *key); static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, const char *key, int *newPtr); +static Tcl_HashEntry * CreateHashEntry(Tcl_HashTable *tablePtr, const char *key, + int *newPtr); +static Tcl_HashEntry * FindHashEntry(Tcl_HashTable *tablePtr, const char *key); static void RebuildTable(Tcl_HashTable *tablePtr); const Tcl_HashKeyType tclArrayHashKeyType = { @@ -121,7 +124,6 @@ const Tcl_HashKeyType tclStringHashKeyType = { *---------------------------------------------------------------------- */ -#undef Tcl_InitHashTable void Tcl_InitHashTable( register Tcl_HashTable *tablePtr, @@ -186,8 +188,8 @@ Tcl_InitCustomHashTable( tablePtr->downShift = 28; tablePtr->mask = 3; tablePtr->keyType = keyType; - tablePtr->findProc = Tcl_FindHashEntry; - tablePtr->createProc = Tcl_CreateHashEntry; + tablePtr->findProc = FindHashEntry; + tablePtr->createProc = CreateHashEntry; if (typePtr == NULL) { /* @@ -228,10 +230,17 @@ Tcl_InitCustomHashTable( Tcl_HashEntry * Tcl_FindHashEntry( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - const char *key) /* Key to use to find matching entry. */ + const void *key) /* Key to use to find matching entry. */ { + return (*((tablePtr)->findProc))(tablePtr, key); +} - return Tcl_CreateHashEntry(tablePtr, key, NULL); +static Tcl_HashEntry * +FindHashEntry( + Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ + const char *key) /* Key to use to find matching entry. */ +{ + return CreateHashEntry(tablePtr, key, NULL); } @@ -259,6 +268,17 @@ Tcl_FindHashEntry( Tcl_HashEntry * Tcl_CreateHashEntry( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ + const void *key, /* Key to use to find or create matching + * entry. */ + int *newPtr) /* Store info here telling whether a new entry + * was created. */ +{ + return (*((tablePtr)->createProc))(tablePtr, key, newPtr); +} + +static Tcl_HashEntry * +CreateHashEntry( + Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ const char *key, /* Key to use to find or create matching * entry. */ int *newPtr) /* Store info here telling whether a new entry |