#include <stddef.h>
#include <stdint.h>
+#include <string.h>
/* This is the public domain lookup3 hash by Bob Jenkins from
* http://burtleburtle.net/bob/c/lookup3.c, modified for style. */
uint32_t hash_words(const uint32_t *, size_t n_word, uint32_t basis);
uint32_t hash_bytes(const void *, size_t n_bytes, uint32_t basis);
+static inline uint32_t hash_string(const char *s, uint32_t basis)
+{
+ return hash_bytes(s, strlen(s), basis);
+}
+
#endif /* hash.h */
static size_t
hash_name(const char *name)
{
- return hash_bytes(name, strlen(name), 0);
+ return hash_string(name, 0);
}
void
static uint32_t
hash_vlan(const char *trunk_dev, uint32_t vid)
{
- return hash_words(&vid, 1, hash_bytes(trunk_dev, strlen(trunk_dev), 0));
+ return hash_words(&vid, 1, hash_string(trunk_dev, 0));
}
/* Update /proc/net/vlan/<vlan_dev> for 'vlan'. */