ulogd - hashtable_find function - question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm going through ulogd hash.c code. I have a question on
hashtable_find function.

struct hashtable_node *
hashtable_find(const struct hashtable *table, const void *data, int id)
{
	struct llist_head *e;
	struct hashtable_node *n;

	llist_for_each(e, &table->members[id]) {
		n = llist_entry(e, struct hashtable_node, head);
		if (table->compare(n, data)) {
			return n;
		}
	}
	errno = ENOENT;
	return NULL;
}

In the above function, you are passing the id which is the hash value.
Basically it allows you to find the hashnode in the hashtable.
But why we are again calling  compare function and check the
equivalence of the values? Is the id itself not enough?

Thanks & Regards,
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux