Systemd/src/journal/lookup3.h
Shawn Landden c2f1db8f83 use #pragma once instead of foo*foo #define guards
#pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported
in other compilers.

I've been using and maintaining (rebasing) this patch for a while now, as
it annoyed me to see #ifndef fooblahfoo, etc all over the place,
almost arrogant about the annoyance of having to define all these names to
perform a commen but neccicary functionality, when a completely superior
alternative exists.

I havn't sent it till now, cause its kindof a style change, and it is bad
voodoo to mess with style that has been established by more established
editors. So feel free to lambast me as a crazy bafoon.

v2 - preserve externally used headers
2012-07-19 12:30:59 +02:00

23 lines
738 B
C

/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
#include <inttypes.h>
#include <sys/types.h>
uint32_t jenkins_hashword(const uint32_t *k, size_t length, uint32_t initval);
void jenkins_hashword2(const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb);
uint32_t jenkins_hashlittle(const void *key, size_t length, uint32_t initval);
void jenkins_hashlittle2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
uint32_t jenkins_hashbig(const void *key, size_t length, uint32_t initval);
static inline uint64_t hash64(const void *data, size_t length) {
uint32_t a = 0, b = 0;
jenkins_hashlittle2(data, length, &a, &b);
return ((uint64_t) a << 32ULL) | (uint64_t) b;
}