X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Freclists.c;h=7912ca21b76fde18a3f181c8acbd7076337ef003;hb=1498181abb059f78afc0ad4f7bcea0b5c13c7964;hp=284d19c39beef11b28160210a22b917e82fb788a;hpb=5e525d47d446d0c02985f007ae0fb0905444e305;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index 284d19c..7912ca2 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -25,7 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include -#include "pazpar2.h" +#include "ppmutex.h" +#include "session.h" #include "reclists.h" #include "jenkins_hash.h" @@ -249,13 +250,14 @@ struct reclist *reclist_create(NMEM nmem) res->num_records = 0; res->mutex = 0; - yaz_mutex_create(&res->mutex); + pazpar2_mutex_create(&res->mutex, "reclist"); return res; } void reclist_destroy(struct reclist *l) { - yaz_mutex_destroy(&l->mutex); + if (l) + yaz_mutex_destroy(&l->mutex); } int reclist_get_num_records(struct reclist *l) @@ -266,10 +268,10 @@ int reclist_get_num_records(struct reclist *l) } // Insert a record. Return record cluster (newly formed or pre-existing) -struct record_cluster *reclist_insert( struct reclist *l, - struct conf_service *service, - struct record *record, - char *merge_key, int *total) +struct record_cluster *reclist_insert(struct reclist *l, + struct conf_service *service, + struct record *record, + const char *merge_key, int *total) { unsigned int bucket; struct reclist_bucket **p; @@ -307,10 +309,10 @@ struct record_cluster *reclist_insert( struct reclist *l, new->record = cluster; new->hnext = 0; cluster->records = record; - cluster->merge_key = merge_key; + cluster->merge_key = nmem_strdup(l->nmem, merge_key); cluster->relevance_score = 0; cluster->term_frequency_vec = 0; - cluster->recid = merge_key; + cluster->recid = nmem_strdup(l->nmem, merge_key); (*total)++; cluster->metadata = nmem_malloc(l->nmem,