Cosmetic changes
git-svn-id: svn://svn.cc65.org/cc65/trunk@2559 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -74,7 +74,7 @@ static void HT_Alloc (HashTable* T)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
HashNode* HT_Find (const HashTable* T, const void* Index)
|
HashNode* HT_Find (const HashTable* T, const void* Key)
|
||||||
/* Find the node with the given index */
|
/* Find the node with the given index */
|
||||||
{
|
{
|
||||||
unsigned Hash;
|
unsigned Hash;
|
||||||
@@ -86,7 +86,7 @@ HashNode* HT_Find (const HashTable* T, const void* Index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate the hash over the index */
|
/* Generate the hash over the index */
|
||||||
Hash = T->Func->GenHash (Index);
|
Hash = T->Func->GenHash (Key);
|
||||||
|
|
||||||
/* Search for the entry in the given chain */
|
/* Search for the entry in the given chain */
|
||||||
N = T->Table[Hash % T->Slots];
|
N = T->Table[Hash % T->Slots];
|
||||||
@@ -96,7 +96,7 @@ HashNode* HT_Find (const HashTable* T, const void* Index)
|
|||||||
* if it is not really necessary.
|
* if it is not really necessary.
|
||||||
*/
|
*/
|
||||||
if (N->Hash == Hash &&
|
if (N->Hash == Hash &&
|
||||||
T->Func->Compare (Index, T->Func->GetIndex (N->Entry))) {
|
T->Func->Compare (Key, T->Func->GetIndex (N->Entry))) {
|
||||||
/* Found */
|
/* Found */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -111,11 +111,11 @@ HashNode* HT_Find (const HashTable* T, const void* Index)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void* HT_FindEntry (const HashTable* T, const void* Index)
|
void* HT_FindEntry (const HashTable* T, const void* Key)
|
||||||
/* Find the node with the given index and return the corresponding entry */
|
/* Find the node with the given index and return the corresponding entry */
|
||||||
{
|
{
|
||||||
/* First, search for the hash node */
|
/* First, search for the hash node */
|
||||||
HashNode* N = HT_Find (T, Index);
|
HashNode* N = HT_Find (T, Key);
|
||||||
|
|
||||||
/* Convert the node into an entry if necessary */
|
/* Convert the node into an entry if necessary */
|
||||||
return N? N->Entry : 0;
|
return N? N->Entry : 0;
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ struct HashNode {
|
|||||||
typedef struct HashFunctions HashFunctions;
|
typedef struct HashFunctions HashFunctions;
|
||||||
struct HashFunctions {
|
struct HashFunctions {
|
||||||
|
|
||||||
unsigned (*GenHash) (const void* Index);
|
unsigned (*GenHash) (const void* Key);
|
||||||
/* Generate the hash over an index. */
|
/* Generate the hash over a key. */
|
||||||
|
|
||||||
const void* (*GetIndex) (void* Entry);
|
const void* (*GetIndex) (void* Entry);
|
||||||
/* Given a pointer to the user entry data, return a pointer to the index */
|
/* Given a pointer to the user entry data, return a pointer to the index */
|
||||||
@@ -74,8 +74,8 @@ struct HashFunctions {
|
|||||||
HashNode* (*GetHashNode) (void* Entry);
|
HashNode* (*GetHashNode) (void* Entry);
|
||||||
/* Given a pointer to the user entry data, return a pointer to the hash node */
|
/* Given a pointer to the user entry data, return a pointer to the hash node */
|
||||||
|
|
||||||
int (*Compare) (const void* Index1, const void* Index2);
|
int (*Compare) (const void* Key1, const void* Key2);
|
||||||
/* Compare two indices for equality */
|
/* Compare two keys for equality */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Hash table */
|
/* Hash table */
|
||||||
@@ -169,11 +169,11 @@ INLINE HashTable* NewHashTable (unsigned Slots, const HashFunctions* Func)
|
|||||||
void FreeHashTable (HashTable* T);
|
void FreeHashTable (HashTable* T);
|
||||||
/* Free a hash table. Note: This will not free the entries in the table! */
|
/* Free a hash table. Note: This will not free the entries in the table! */
|
||||||
|
|
||||||
HashNode* HT_Find (const HashTable* T, const void* Index);
|
HashNode* HT_Find (const HashTable* T, const void* Key);
|
||||||
/* Find the node with the given index */
|
/* Find the node with the given key*/
|
||||||
|
|
||||||
void* HT_FindEntry (const HashTable* T, const void* Index);
|
void* HT_FindEntry (const HashTable* T, const void* Key);
|
||||||
/* Find the node with the given index and return the corresponding entry */
|
/* Find the node with the given key and return the corresponding entry */
|
||||||
|
|
||||||
void HT_Insert (HashTable* T, HashNode* N);
|
void HT_Insert (HashTable* T, HashNode* N);
|
||||||
/* Insert a node into the given hash table */
|
/* Insert a node into the given hash table */
|
||||||
|
|||||||
Reference in New Issue
Block a user