diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2015-11-16 09:21:20 +0100 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2015-11-16 15:20:29 +0100 |
commit | dbe81cbd2a93088236a2e4e41eeb33378940f7b9 (patch) | |
tree | 8aec120af6f424803074d35827fbfb5048d8a9cf /src/journal/journald-rate-limit.c | |
parent | 8dd85afe761885a9c47173cdafd1b7f9b36d08e6 (diff) |
siphash24: change result argument to uint64_t
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.
This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead.
Diffstat (limited to 'src/journal/journald-rate-limit.c')
-rw-r--r-- | src/journal/journald-rate-limit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c index 434ddc8ac9..ad78d09294 100644 --- a/src/journal/journald-rate-limit.c +++ b/src/journal/journald-rate-limit.c @@ -162,7 +162,7 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r, siphash24_init(&state, r->hash_key); string_hash_func(g->id, &state); - siphash24_finalize((uint8_t*)&g->hash, &state); + siphash24_finalize(&g->hash, &state); journal_rate_limit_vacuum(r, ts); @@ -230,7 +230,7 @@ int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, u siphash24_init(&state, r->hash_key); string_hash_func(id, &state); - siphash24_finalize((uint8_t*)&h, &state); + siphash24_finalize(&h, &state); g = r->buckets[h % BUCKETS_MAX]; LIST_FOREACH(bucket, g, g) |