X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Freclists.c;h=5afd0572c486ad1dfc27201e256db35524413012;hb=817e3ec506c4095bc4fcc1923cee36153ef4ee43;hp=f07a2cb2ea8f9d0081afe1c903b470eac51cb0e4;hpb=3895572f92f283f91e8b30064c11ee55dfd078c9;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index f07a2cb..5afd057 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2013 Index Data + Copyright (C) Index Data 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 @@ -330,16 +330,19 @@ struct record_cluster *reclist_read_record(struct reclist *l) void reclist_enter(struct reclist *l) { yaz_mutex_enter(l->mutex); - if (l) - l->sorted_ptr = l->sorted_list; + l->sorted_ptr = l->sorted_list; } void reclist_leave(struct reclist *l) { yaz_mutex_leave(l->mutex); - if (l) - l->sorted_ptr = l->sorted_list; + l->sorted_ptr = l->sorted_list; +} + +void reclist_rewind(struct reclist *l) +{ + l->sorted_ptr = l->sorted_list; } @@ -496,21 +499,19 @@ struct record_cluster *reclist_insert(struct reclist *l, // We found a matching record. Merge them if (!strcmp(merge_key, mkr->value)) { - struct record **re; - rb = *p; - for (re = &rb->record->records; *re; re = &(*re)->next) + if (!cluster) { - if ((*re)->client == record->client && - record_compare(record, *re, service)) + struct record **re; + for (re = &rb->record->records; *re; re = &(*re)->next) { - yaz_mutex_leave(l->mutex); - return 0; + if ((*re)->client == record->client && + record_compare(record, *re, service)) + { + yaz_mutex_leave(l->mutex); + return 0; + } } - } - - if (!cluster) - { cluster = rb->record; *re = record; record->next = 0;