core: fix result of hash function (in hashtables) on 32-bit systems
parent
8a93906beb
commit
cf3e0ccbfd
|
@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
|||
|
||||
== Version 1.0 (under dev)
|
||||
|
||||
* core: fix result of hash function (in hashtables) on 32-bit systems
|
||||
* core: add terabyte unit for size displayed
|
||||
* core: fix insert of mouse code in input line after a partial key combo
|
||||
(closes #130)
|
||||
|
|
|
@ -3366,8 +3366,8 @@ Prototype:
|
|||
struct t_hashtable *weechat_hashtable_new (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
unsigned long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
int (*callback_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1,
|
||||
const void *key2));
|
||||
|
|
|
@ -3415,8 +3415,8 @@ Prototype :
|
|||
struct t_hashtable *weechat_hashtable_new (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
unsigned long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
int (*callback_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1,
|
||||
const void *key2));
|
||||
|
|
|
@ -3440,8 +3440,8 @@ Prototipo:
|
|||
struct t_hashtable *weechat_hashtable_new (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
unsigned long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
int (*callback_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1,
|
||||
const void *key2));
|
||||
|
|
|
@ -3362,8 +3362,8 @@ _WeeChat バージョン 0.3.3 以上で利用可。_
|
|||
struct t_hashtable *weechat_hashtable_new (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
unsigned long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
int (*callback_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1,
|
||||
const void *key2));
|
||||
|
|
|
@ -72,10 +72,10 @@ hashtable_get_type (const char *type)
|
|||
* Returns the hash of the string.
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
unsigned long long
|
||||
hashtable_hash_key_djb2 (const char *string)
|
||||
{
|
||||
unsigned long hash;
|
||||
unsigned long long hash;
|
||||
const char *ptr_string;
|
||||
|
||||
hash = 5381;
|
||||
|
@ -93,28 +93,28 @@ hashtable_hash_key_djb2 (const char *string)
|
|||
* Returns the hash of the key, depending on the type.
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
unsigned long long
|
||||
hashtable_hash_key_default_cb (struct t_hashtable *hashtable, const void *key)
|
||||
{
|
||||
unsigned long hash;
|
||||
unsigned long long hash;
|
||||
|
||||
hash = 0;
|
||||
|
||||
switch (hashtable->type_keys)
|
||||
{
|
||||
case HASHTABLE_INTEGER:
|
||||
hash = (unsigned long)(*((int *)key));
|
||||
hash = (unsigned long long)(*((int *)key));
|
||||
break;
|
||||
case HASHTABLE_STRING:
|
||||
hash = hashtable_hash_key_djb2 ((const char *)key);
|
||||
break;
|
||||
case HASHTABLE_POINTER:
|
||||
hash = (unsigned long)((void *)key);
|
||||
hash = (unsigned long long)((unsigned long)((void *)key));
|
||||
break;
|
||||
case HASHTABLE_BUFFER:
|
||||
break;
|
||||
case HASHTABLE_TIME:
|
||||
hash = (unsigned long)(*((time_t *)key));
|
||||
hash = (unsigned long long)(*((time_t *)key));
|
||||
break;
|
||||
case HASHTABLE_NUM_TYPES:
|
||||
break;
|
||||
|
@ -375,7 +375,7 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
|
|||
const void *key, int key_size,
|
||||
const void *value, int value_size)
|
||||
{
|
||||
unsigned long hash;
|
||||
unsigned long long hash;
|
||||
struct t_hashtable_item *ptr_item, *pos_item, *new_item;
|
||||
|
||||
if (!hashtable || !key
|
||||
|
@ -469,9 +469,9 @@ hashtable_set (struct t_hashtable *hashtable,
|
|||
|
||||
struct t_hashtable_item *
|
||||
hashtable_get_item (struct t_hashtable *hashtable, const void *key,
|
||||
unsigned long *hash)
|
||||
unsigned long long *hash)
|
||||
{
|
||||
unsigned long key_hash;
|
||||
unsigned long long key_hash;
|
||||
struct t_hashtable_item *ptr_item;
|
||||
|
||||
if (!hashtable || !key)
|
||||
|
@ -1109,7 +1109,7 @@ hashtable_add_to_infolist (struct t_hashtable *hashtable,
|
|||
void
|
||||
hashtable_remove_item (struct t_hashtable *hashtable,
|
||||
struct t_hashtable_item *item,
|
||||
unsigned long hash)
|
||||
unsigned long long hash)
|
||||
{
|
||||
if (!hashtable || !item)
|
||||
return;
|
||||
|
@ -1139,7 +1139,7 @@ void
|
|||
hashtable_remove (struct t_hashtable *hashtable, const void *key)
|
||||
{
|
||||
struct t_hashtable_item *ptr_item;
|
||||
unsigned long hash;
|
||||
unsigned long long hash;
|
||||
|
||||
if (!hashtable || !key)
|
||||
return;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
struct t_hashtable;
|
||||
struct t_infolist_item;
|
||||
|
||||
typedef unsigned long (t_hashtable_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key);
|
||||
typedef unsigned long long (t_hashtable_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key);
|
||||
typedef int (t_hashtable_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1, const void *key2);
|
||||
typedef void (t_hashtable_free_key)(struct t_hashtable *hashtable,
|
||||
|
@ -40,7 +40,7 @@ typedef void (t_hashtable_map_string)(void *data,
|
|||
|
||||
/*
|
||||
* Hashtable is a structure with an array "htable", each entry is a pointer
|
||||
* to a linked list, and it is read with hashed key (as unsigned long).
|
||||
* to a linked list, and it is read with hashed key (as unsigned long long).
|
||||
* Keys with same hashed key are grouped in a linked list pointed by htable.
|
||||
* The htable is not sorted, the linked list is sorted.
|
||||
*
|
||||
|
@ -112,7 +112,7 @@ struct t_hashtable
|
|||
/* never asked) */
|
||||
};
|
||||
|
||||
extern unsigned long hashtable_hash_key_djb2 (const char *string);
|
||||
extern unsigned long long hashtable_hash_key_djb2 (const char *string);
|
||||
extern struct t_hashtable *hashtable_new (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
|
@ -128,7 +128,7 @@ extern struct t_hashtable_item *hashtable_set (struct t_hashtable *hashtable,
|
|||
const void *value);
|
||||
extern struct t_hashtable_item *hashtable_get_item (struct t_hashtable *hashtable,
|
||||
const void *key,
|
||||
unsigned long *hash);
|
||||
unsigned long long *hash);
|
||||
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,
|
||||
|
|
|
@ -2779,7 +2779,7 @@ string_replace_with_callback (const char *string,
|
|||
* Returns the hash of the shared string (variant of djb2).
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
unsigned long long
|
||||
string_shared_hash_key (struct t_hashtable *hashtable,
|
||||
const void *key)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ struct timeval;
|
|||
* please change the date with current one; for a second change at same
|
||||
* date, increment the 01, otherwise please keep 01.
|
||||
*/
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140610-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140802-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
|
@ -339,8 +339,8 @@ struct t_weechat_plugin
|
|||
struct t_hashtable *(*hashtable_new) (int size,
|
||||
const char *type_keys,
|
||||
const char *type_values,
|
||||
unsigned long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
|
||||
const void *key),
|
||||
int (*callback_keycmp)(struct t_hashtable *hashtable,
|
||||
const void *key1,
|
||||
const void *key2));
|
||||
|
|
Loading…
Reference in New Issue