X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Freclists.c;h=3e3100c8be1dfdfdb12e79738105256e09ca45c3;hb=fdf549621a2712e2e7fafd5966bbbf9a5c891adf;hp=85021c6b56d096f7077e51f5b06bcc9f26899ed0;hpb=15790e226ac62ed0813c89ba29fcd9b3d564fe19;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index 85021c6..3e3100c 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -27,8 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "pazpar2.h" #include "reclists.h" - -extern struct parameters global_parameters; +#include "jenkins_hash.h" static struct reclist_sortparms *qsort_sortparms = 0; /* thread pr */ @@ -233,23 +232,6 @@ void reclist_rewind(struct reclist *l) l->pointer = 0; } -// Jenkins one-at-a-time hash (from wikipedia) -static unsigned int hash(const unsigned char *key) -{ - unsigned int hash = 0; - - while (*key) - { - hash += *(key++); - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; -} - struct reclist *reclist_create(NMEM nmem, int numrecs) { int hashsize = 1; @@ -289,7 +271,7 @@ struct record_cluster *reclist_insert( struct reclist *l, assert(merge_key); assert(total); - bucket = hash((unsigned char*) merge_key) & l->hashmask; + bucket = jenkins_hash((unsigned char*) merge_key) & l->hashmask; for (p = &l->hashtable[bucket]; *p; p = &(*p)->next) {