diff options
| author | Christian Franke <chris@opensourcerouting.org> | 2017-08-03 13:37:38 +0200 |
|---|---|---|
| committer | Christian Franke <chris@opensourcerouting.org> | 2017-08-03 13:37:58 +0200 |
| commit | 7a7761d21c9301bdfffc5f3faa2318819c6a0460 (patch) | |
| tree | 66e239089521b512167c91c2c6c96680a64beff6 /lib/table.c | |
| parent | 02cd317ea0cc7d39ff7ae121468c9cd68a24f9ae (diff) | |
lib: move prefix hash key to prefix.c to allow global use
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'lib/table.c')
| -rw-r--r-- | lib/table.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/table.c b/lib/table.c index 2defa4fb62..e89d7d1c67 100644 --- a/lib/table.c +++ b/lib/table.c @@ -27,7 +27,6 @@ #include "table.h" #include "memory.h" #include "sockunion.h" -#include "jhash.h" DEFINE_MTYPE(LIB, ROUTE_TABLE, "Route table") DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node") @@ -35,18 +34,6 @@ DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node") static void route_node_delete(struct route_node *); static void route_table_free(struct route_table *); -static unsigned route_table_hash_key(void *pp) -{ - struct prefix copy; - - /* make sure *all* unused bits are zero, particularly including - * alignment / - * padding and unused prefix bytes. */ - memset(©, 0, sizeof(copy)); - prefix_copy(©, (struct prefix *)pp); - return jhash(©, sizeof(copy), 0x55aa5a5a); -} - static int route_table_hash_cmp(const void *a, const void *b) { const struct prefix *pa = a, *pb = b; @@ -63,7 +50,7 @@ route_table_init_with_delegate(route_table_delegate_t *delegate) rt = XCALLOC(MTYPE_ROUTE_TABLE, sizeof(struct route_table)); rt->delegate = delegate; - rt->hash = hash_create(route_table_hash_key, route_table_hash_cmp, + rt->hash = hash_create(prefix_hash_key, route_table_hash_cmp, "route table hash"); return rt; } |
