From 9bf3b53533cdc9b95c921b71da755401f223f765 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 22 Dec 2013 19:59:12 +0100 Subject: shared: switch our hash table implementation over to SipHash SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it. --- src/core/dbus-client-track.c | 4 ++-- src/core/manager.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/dbus-client-track.c b/src/core/dbus-client-track.c index d98f21d46f..07dfea49e6 100644 --- a/src/core/dbus-client-track.c +++ b/src/core/dbus-client-track.c @@ -22,10 +22,10 @@ #include "bus-util.h" #include "dbus-client-track.h" -static unsigned tracked_client_hash(const void *a) { +static unsigned long tracked_client_hash(const void *a, const uint8_t hash_key[HASH_KEY_SIZE]) { const BusTrackedClient *x = a; - return string_hash_func(x->name) ^ PTR_TO_UINT(x->bus); + return string_hash_func(x->name, hash_key) ^ trivial_hash_func(x->bus, hash_key); } static int tracked_client_compare(const void *a, const void *b) { diff --git a/src/core/manager.c b/src/core/manager.c index b9aa6dcfd5..d8d5667dc2 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -482,7 +482,7 @@ static int manager_setup_notify(Manager *m) { } if (getpid() != 1 || detect_container(NULL) > 0) - snprintf(sa.un.sun_path, sizeof(sa.un.sun_path), NOTIFY_SOCKET "/%llu", random_ull()); + snprintf(sa.un.sun_path, sizeof(sa.un.sun_path), NOTIFY_SOCKET "/%" PRIx64, random_u64()); else strncpy(sa.un.sun_path, NOTIFY_SOCKET, sizeof(sa.un.sun_path)); sa.un.sun_path[0] = 0; -- cgit v1.2.3-54-g00ecf