1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Add const declarations to hash-table functions.

This commit is contained in:
hniksic 2003-10-09 06:32:28 -07:00
parent d0e36f1261
commit b49e89e78a
3 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,11 @@
2003-10-09 Hrvoje Niksic <hniksic@xemacs.org>
* hash.c (hash_table_get): Declare hash-table argument as const.
(find_mapping): Ditto.
(hash_table_get_pair): Ditto.
(hash_table_contains): Ditto.
(hash_table_count): Ditto.
2003-10-08 Hrvoje Niksic <hniksic@xemacs.org> 2003-10-08 Hrvoje Niksic <hniksic@xemacs.org>
* html-url.c (get_urls_html): Parse the appropriate flags to * html-url.c (get_urls_html): Parse the appropriate flags to

View File

@ -272,7 +272,7 @@ hash_table_destroy (struct hash_table *ht)
mapping that matches KEY, or NULL if none matches. */ mapping that matches KEY, or NULL if none matches. */
static inline struct mapping * static inline struct mapping *
find_mapping (struct hash_table *ht, const void *key) find_mapping (const struct hash_table *ht, const void *key)
{ {
struct mapping *mappings = ht->mappings; struct mapping *mappings = ht->mappings;
int size = ht->size; int size = ht->size;
@ -293,7 +293,7 @@ find_mapping (struct hash_table *ht, const void *key)
function. */ function. */
void * void *
hash_table_get (struct hash_table *ht, const void *key) hash_table_get (const struct hash_table *ht, const void *key)
{ {
struct mapping *mp = find_mapping (ht, key); struct mapping *mp = find_mapping (ht, key);
if (mp) if (mp)
@ -306,7 +306,7 @@ hash_table_get (struct hash_table *ht, const void *key)
value. Returns non-zero on success. */ value. Returns non-zero on success. */
int int
hash_table_get_pair (struct hash_table *ht, const void *lookup_key, hash_table_get_pair (const struct hash_table *ht, const void *lookup_key,
void *orig_key, void *value) void *orig_key, void *value)
{ {
struct mapping *mp = find_mapping (ht, lookup_key); struct mapping *mp = find_mapping (ht, lookup_key);
@ -326,7 +326,7 @@ hash_table_get_pair (struct hash_table *ht, const void *lookup_key,
/* Return 1 if HT contains KEY, 0 otherwise. */ /* Return 1 if HT contains KEY, 0 otherwise. */
int int
hash_table_contains (struct hash_table *ht, const void *key) hash_table_contains (const struct hash_table *ht, const void *key)
{ {
return find_mapping (ht, key) != NULL; return find_mapping (ht, key) != NULL;
} }
@ -494,7 +494,7 @@ hash_table_map (struct hash_table *ht,
greater than the number of elements. */ greater than the number of elements. */
int int
hash_table_count (struct hash_table *ht) hash_table_count (const struct hash_table *ht)
{ {
return ht->count; return ht->count;
} }

View File

@ -50,10 +50,10 @@ struct hash_table *hash_table_new PARAMS ((int,
const void *))); const void *)));
void hash_table_destroy PARAMS ((struct hash_table *)); void hash_table_destroy PARAMS ((struct hash_table *));
void *hash_table_get PARAMS ((struct hash_table *, const void *)); void *hash_table_get PARAMS ((const struct hash_table *, const void *));
int hash_table_get_pair PARAMS ((struct hash_table *, const void *, int hash_table_get_pair PARAMS ((const struct hash_table *, const void *,
void *, void *)); void *, void *));
int hash_table_contains PARAMS ((struct hash_table *, const void *)); int hash_table_contains PARAMS ((const struct hash_table *, const void *));
void hash_table_put PARAMS ((struct hash_table *, const void *, void *)); void hash_table_put PARAMS ((struct hash_table *, const void *, void *));
int hash_table_remove PARAMS ((struct hash_table *, const void *)); int hash_table_remove PARAMS ((struct hash_table *, const void *));
@ -62,7 +62,7 @@ void hash_table_clear PARAMS ((struct hash_table *));
void hash_table_map PARAMS ((struct hash_table *, void hash_table_map PARAMS ((struct hash_table *,
int (*) (void *, void *, void *), int (*) (void *, void *, void *),
void *)); void *));
int hash_table_count PARAMS ((struct hash_table *)); int hash_table_count PARAMS ((const struct hash_table *));
unsigned long string_hash PARAMS ((const void *)); unsigned long string_hash PARAMS ((const void *));
int string_cmp PARAMS ((const void *, const void *)); int string_cmp PARAMS ((const void *, const void *));