From f9956b9524ddafdb9d0cec042213eaa8229aad8c Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 29 Mar 2011 01:49:16 +0100 Subject: Bring "ex" version up to date with 0.99.18 Release: 0.99.18ex15p -- Pipework Branch Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.) --- lib/hash.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/hash.c') diff --git a/lib/hash.c b/lib/hash.c index 672327ec..6db79ea7 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -101,6 +101,17 @@ hash_lookup (struct hash *hash, void *data) return hash_get (hash, data, NULL); } +/* Simple Bernstein hash which is simple and fast for common case */ +unsigned int string_hash_make (const char *str) +{ + unsigned int hash = 0; + + while (*str) + hash = (hash * 33) ^ (unsigned int) *str++; + + return hash; +} + /* This function release registered value from specified hash. When release is successfully finished, return the data pointer in the hash backet. */ -- cgit v1.2.3