Allow any number of worker threads for sel_thread. Added optional parameter
[pazpar2-moved-to-github.git] / src / reclists.c
index a1e104c..ed5c0ec 100644 (file)
@@ -1,5 +1,22 @@
-/*
- * $Id: reclists.c,v 1.7 2007-01-15 04:34:28 quinn Exp $
+/* $Id: reclists.c,v 1.12 2007-04-17 12:15:32 marc Exp $
+   Copyright (c) 2006-2007, Index Data.
+
+This file is part of Pazpar2.
+
+Pazpar2 is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Pazpar2; see the file LICENSE.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
  */
 
 #include <assert.h>
@@ -187,15 +204,23 @@ struct reclist *reclist_create(NMEM nmem, int numrecs)
 }
 
 // Insert a record. Return record cluster (newly formed or pre-existing)
-struct record_cluster *reclist_insert(struct reclist *l, struct record  *record,
-        char *merge_key, int *total)
+struct record_cluster *reclist_insert( struct reclist *l,
+                                       struct conf_service *service, 
+                                       struct record  *record,
+                                       char *merge_key, int *total)
 {
     unsigned int bucket;
     struct reclist_bucket **p;
     struct record_cluster *cluster = 0;
-    struct conf_service *service = global_parameters.server->service;
+    
+    assert(service);
+    assert(l);
+    assert(record);
+    assert(merge_key);
+    assert(total);
 
     bucket = hash((unsigned char*) merge_key) & l->hashmask;
+
     for (p = &l->hashtable[bucket]; *p; p = &(*p)->next)
     {
         // We found a matching record. Merge them