Hi This is for hash collisions: What if 2 values have the same hash value? Regards, Steffen > -----Original Message----- > From: netfilter-owner@xxxxxxxxxxxxxxx [mailto:netfilter- > owner@xxxxxxxxxxxxxxx] On Behalf Of Gomathivinayagam Muthuvinayagam > Sent: Wednesday, August 08, 2012 4:28 PM > To: netfilter@xxxxxxxxxxxxxxx > Subject: ulogd - hashtable_find function - question > > 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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature