diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-17 10:39:51 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-17 10:39:51 +0200 |
commit | ebf94445b9a49318122392d7fc7b098027706d97 (patch) | |
tree | 325f5a9a56fb4607b0531a3501195059b5736c97 /src/core | |
parent | eff0f9abdb53b0c0e1c2060a6f9598c51347e1bb (diff) | |
download | weechat-ebf94445b9a49318122392d7fc7b098027706d97.zip |
Use const void * for keys and values in some hashtable functions
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-hashtable.c | 12 | ||||
-rw-r--r-- | src/core/wee-hashtable.h | 8 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index 4575f3d95..f11e7672c 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -158,7 +158,8 @@ hashtable_new (int size, */ void -hashtable_alloc_type (enum t_hashtable_type type, void *value, int size_value, +hashtable_alloc_type (enum t_hashtable_type type, + const void *value, int size_value, void **pointer, int *size) { switch (type) @@ -179,7 +180,7 @@ hashtable_alloc_type (enum t_hashtable_type type, void *value, int size_value, *size = (*pointer) ? strlen (*pointer) + 1 : 0; break; case HASHTABLE_POINTER: - *pointer = value; + *pointer = (void *)value; *size = sizeof (void *); break; case HASHTABLE_BUFFER: @@ -239,8 +240,8 @@ hashtable_free_type (enum t_hashtable_type type, void *value) int hashtable_set_with_size (struct t_hashtable *hashtable, - void *key, int key_size, - void *value, int value_size) + const void *key, int key_size, + const void *value, int value_size) { unsigned int hash; struct t_hashtable_item *ptr_item, *pos_item, *new_item; @@ -319,7 +320,8 @@ hashtable_set_with_size (struct t_hashtable *hashtable, */ int -hashtable_set (struct t_hashtable *hashtable, void *key, void *value) +hashtable_set (struct t_hashtable *hashtable, + const void *key, const void *value) { return hashtable_set_with_size (hashtable, key, 0, value, 0); } diff --git a/src/core/wee-hashtable.h b/src/core/wee-hashtable.h index fbc06eb66..baad83773 100644 --- a/src/core/wee-hashtable.h +++ b/src/core/wee-hashtable.h @@ -109,10 +109,10 @@ extern struct t_hashtable *hashtable_new (int size, t_hashtable_hash_key *hash_key_cb, t_hashtable_keycmp *keycmp_cb); extern int hashtable_set_with_size (struct t_hashtable *hashtable, - void *key, int key_size, - void *value, int value_size); -extern int hashtable_set (struct t_hashtable *hashtable, void *key, - void *value); + const void *key, int key_size, + const void *value, int value_size); +extern int hashtable_set (struct t_hashtable *hashtable, const void *key, + const void *value); extern void *hashtable_get (struct t_hashtable *hashtable, const void *key); extern int hashtable_has_key (struct t_hashtable *hashtable, const void *key); extern void hashtable_map (struct t_hashtable *hashtable, |