util/hash.[ch]: const hash 'key' for API and internal type
This is mainly to modify the function signature to accept const data pointers to keys. Patch required to ease use of const by API consumers.
This commit is contained in:
parent
91da638579
commit
efb5d9001c
|
|
@ -282,7 +282,7 @@ hash(table, key)
|
|||
HashEntry *
|
||||
HashLookOnly(table, key)
|
||||
HashTable *table; /* Hash table to search. */
|
||||
char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
const char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
* as described in HashInit()'s comments.
|
||||
*/
|
||||
{
|
||||
|
|
@ -352,7 +352,7 @@ next:
|
|||
HashEntry *
|
||||
HashFind(table, key)
|
||||
HashTable *table; /* Hash table to search. */
|
||||
char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
const char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
* as described in HashInit()'s comments.
|
||||
*/
|
||||
{
|
||||
|
|
@ -577,7 +577,7 @@ HashStats(table)
|
|||
void
|
||||
HashRemove(table, key)
|
||||
HashTable *table; /* Hash table to search. */
|
||||
char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
const char *key; /* Interpreted according to table->ht_ptrKeys
|
||||
* as described in HashInit()'s comments.
|
||||
*/
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ typedef struct h1
|
|||
struct h1 *h_next; /* Next element, zero for end. */
|
||||
union
|
||||
{
|
||||
char *h_ptr; /* One-word key value to identify entry. */
|
||||
const char *h_ptr; /* One-word key value to identify entry. */
|
||||
unsigned h_words[1]; /* N-word key value. Note: the actual
|
||||
* size may be longer if necessary to hold
|
||||
* the entire key.
|
||||
|
|
@ -113,9 +113,9 @@ typedef struct h2
|
|||
|
||||
extern void HashInit(HashTable *, int, int), HashInitClient(), HashStats(), HashKill(),
|
||||
HashFreeKill();
|
||||
extern HashEntry *HashFind(HashTable *, char *);
|
||||
extern HashEntry *HashLookOnly(HashTable *, char *);
|
||||
extern void HashRemove(HashTable *, char *);
|
||||
extern HashEntry *HashFind(HashTable *, const char *);
|
||||
extern HashEntry *HashLookOnly(HashTable *, const char *);
|
||||
extern void HashRemove(HashTable *, const char *);
|
||||
extern void HashStartSearch(HashSearch *);
|
||||
extern HashEntry *HashNext(HashTable *, HashSearch *);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue