diff options
author | nijtmans <nijtmans> | 2010-12-31 17:15:16 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-12-31 17:15:16 (GMT) |
commit | e5d83fec3fdbff4766dde47e113d88b02626bc70 (patch) | |
tree | 68339dc73e8b71722bf29619d460ba1226b37b7e /generic | |
parent | b6620722042118591eb20a1be3cb565d2518a94c (diff) | |
download | tcl-e5d83fec3fdbff4766dde47e113d88b02626bc70.zip tcl-e5d83fec3fdbff4766dde47e113d88b02626bc70.tar.gz tcl-e5d83fec3fdbff4766dde47e113d88b02626bc70.tar.bz2 |
[Bug 3007895]: Tcl_(Find|Create)HashEntry stub entries can never be called.
They still cannot be called (no change in functionality), but at least they now do exactly the same as the Tcl_(Find|Create)HashEntry macro's,
so the confusion addressed in this Bug report is gone.
(Backported from Tcl 8.6)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclHash.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/generic/tclHash.c b/generic/tclHash.c index a606885..fa4952a 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.33.2.1 2008/11/18 07:02:17 nijtmans Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.33.2.2 2010/12/31 17:15:16 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); Tcl_HashKeyType tclArrayHashKeyType = { @@ -186,8 +189,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) { /* @@ -230,8 +233,15 @@ Tcl_FindHashEntry( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ const char *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); } @@ -264,6 +274,17 @@ Tcl_CreateHashEntry( 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 + * was created. */ +{ register Tcl_HashEntry *hPtr; const Tcl_HashKeyType *typePtr; unsigned int hash; |