From 0cb3c286883b694fc52a18a3b559ff98931641f3 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 6 Oct 2015 15:04:42 +0200 Subject: siphash24: unify API Make the API of the new helpers more similar to the old wrapper. In particular we now return the hash as a byte string to avoid any endianness problems. --- src/journal/journald-rate-limit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/journal') diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c index 7e06117b31..8afd493b50 100644 --- a/src/journal/journald-rate-limit.c +++ b/src/journal/journald-rate-limit.c @@ -57,7 +57,7 @@ struct JournalRateLimitGroup { char *id; JournalRateLimitPool pools[POOLS_MAX]; - unsigned long hash; + uint64_t hash; LIST_FIELDS(JournalRateLimitGroup, bucket); LIST_FIELDS(JournalRateLimitGroup, lru); @@ -158,9 +158,9 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r, if (!g->id) goto fail; - siphash_init(&state, r->hash_key); + siphash24_init(&state, r->hash_key); string_hash_func(g->id, &state); - g->hash = siphash24_finalize(&state); + siphash24_finalize((uint8_t*)&g->hash, &state); journal_rate_limit_vacuum(r, ts); @@ -207,7 +207,7 @@ static unsigned burst_modulate(unsigned burst, uint64_t available) { } int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, uint64_t available) { - unsigned long h; + uint64_t h; JournalRateLimitGroup *g; JournalRateLimitPool *p; struct siphash state; @@ -226,9 +226,9 @@ int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, u ts = now(CLOCK_MONOTONIC); - siphash_init(&state, r->hash_key); + siphash24_init(&state, r->hash_key); string_hash_func(id, &state); - h = siphash24_finalize(&state); + siphash24_finalize((uint8_t*)&h, &state); g = r->buckets[h % BUCKETS_MAX]; LIST_FOREACH(bucket, g, g) -- cgit v1.2.3-54-g00ecf