1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 01:03:14 +02:00

core: use fixed-width integer for computing hashtable DJB2 key hash (closes #1394)

This commit is contained in:
Sébastien Helleu
2019-08-19 23:29:22 +02:00
parent 80f103b68a
commit 7f62985f89
3 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ New features::
Bug fixes::
* core: use fixed-width integer for computing nick hash (issue #1394)
* core: use fixed-width integer for computing nick and hashtable DJB2 key hashes (issue #1394)
* core: create or update option weechat.notify.xxx when function buffer_set is called with "notify" property (issue #1390)
* core: fix memory leak in case of error when building content of bar item for display (issue #1384)
* core: send command line parameter to plugins only if the name starts with the plugin name followed by a colon
+2 -1
View File
@@ -24,6 +24,7 @@
#endif
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
@@ -75,7 +76,7 @@ hashtable_get_type (const char *type)
unsigned long long
hashtable_hash_key_djb2 (const char *string)
{
unsigned long long hash;
uint64_t hash;
const char *ptr_string;
hash = 5381;
+8 -3
View File
@@ -28,9 +28,11 @@ extern "C"
#include "src/plugins/plugin.h"
}
#define HASHTABLE_TEST_KEY "test"
#define HASHTABLE_TEST_KEY_HASH 5849825121ULL
#define HASHTABLE_TEST_VALUE "this is a value"
#define HASHTABLE_TEST_KEY "test"
#define HASHTABLE_TEST_KEY_HASH 5849825121ULL
#define HASHTABLE_TEST_KEY_LONG "abcdefghijklmnopqrstuvwxyz"
#define HASHTABLE_TEST_KEY_LONG_HASH 11232856562070989738ULL
#define HASHTABLE_TEST_VALUE "this is a value"
TEST_GROUP(CoreHashtable)
{
@@ -47,6 +49,9 @@ TEST(CoreHashtable, HashDbj2)
hash = hashtable_hash_key_djb2 (HASHTABLE_TEST_KEY);
CHECK(hash == HASHTABLE_TEST_KEY_HASH);
hash = hashtable_hash_key_djb2 (HASHTABLE_TEST_KEY_LONG);
CHECK(hash == HASHTABLE_TEST_KEY_LONG_HASH);
}
/*