-/* $Id: pazpar2.c,v 1.14 2007-01-04 22:04:25 quinn Exp $ */;
+/* $Id: pazpar2.c,v 1.15 2007-01-05 20:33:05 adam Exp $ */;
#include <stdlib.h>
#include <stdio.h>
if (!(mergekey = xmlGetProp(root, "mergekey")))
{
yaz_log(YLOG_WARN, "No mergekey found in record");
+ xmlFreeDoc(xdoc);
return 0;
}
res->merge_key = normalize_mergekey(mergekey_norm);
head = reclist_insert(se->reclist, res);
+ if (!head)
+ {
+ /* no room for record */
+ xmlFreeDoc(xdoc);
+ return 0;
+ }
relevance_newrec(se->relevance, head);
for (n = root->children; n; n = n->next)
/*
- * $Id: reclists.c,v 1.1 2006-12-20 20:47:16 quinn Exp $
+ * $Id: reclists.c,v 1.2 2007-01-05 20:33:05 adam Exp $
*/
#include <assert.h>
{
unsigned int bucket;
struct reclist_bucket **p;
- struct record *head;
+ struct record *head = 0;
bucket = hash((unsigned char*) record->merge_key) & l->hashmask;
for (p = &l->hashtable[bucket]; *p; p = &(*p)->next)
break;
}
}
- if (!*p) // We made it to the end of the bucket without finding match
+ if (!head && l->num_records < l->flatlist_size)
{
- struct reclist_bucket *new = nmem_malloc(l->nmem,
- sizeof(struct reclist_bucket));
+ struct reclist_bucket *new =
+ nmem_malloc(l->nmem, sizeof(struct reclist_bucket));
+
+ assert(!*p);
+
new->record = record;
record->next_cluster = 0;
new->next = 0;
*p = new;
+ assert(l->num_records < l->flatlist_size);
l->flatlist[l->num_records++] = record;
head = record;
}