projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added check to prevent retrieval of more than global_parameters.toget recs
[pazpar2-moved-to-github.git]
/
src
/
pazpar2.c
diff --git
a/src/pazpar2.c
b/src/pazpar2.c
index
1537054
..
fa2d51f
100644
(file)
--- a/
src/pazpar2.c
+++ b/
src/pazpar2.c
@@
-1,4
+1,4
@@
-/* $Id: pazpar2.c,v 1.12 2007-01-04 07:38:36 adam Exp $ */;
+/* $Id: pazpar2.c,v 1.16 2007-01-06 03:02:47 quinn Exp $ */;
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
@@
-11,6
+11,7
@@
#include <ctype.h>
#include <assert.h>
#include <ctype.h>
#include <assert.h>
+#include <yaz/marcdisp.h>
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/proto.h>
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/proto.h>
@@
-198,6
+199,8
@@
static void send_present(IOCHAN i)
int start = cl->records + 1;
toget = global_parameters.chunk;
int start = cl->records + 1;
toget = global_parameters.chunk;
+ if (toget > global_parameters.toget - cl->records)
+ toget = global_parameters.toget - cl->records;
if (toget > cl->hits - cl->records)
toget = cl->hits - cl->records;
if (toget > cl->hits - cl->records)
toget = cl->hits - cl->records;
@@
-430,6
+433,7
@@
static struct record *ingest_record(struct client *cl, Z_External *rec)
if (!(mergekey = xmlGetProp(root, "mergekey")))
{
yaz_log(YLOG_WARN, "No mergekey found in record");
if (!(mergekey = xmlGetProp(root, "mergekey")))
{
yaz_log(YLOG_WARN, "No mergekey found in record");
+ xmlFreeDoc(xdoc);
return 0;
}
return 0;
}
@@
-445,6
+449,12
@@
static struct record *ingest_record(struct client *cl, Z_External *rec)
res->merge_key = normalize_mergekey(mergekey_norm);
head = reclist_insert(se->reclist, res);
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)
relevance_newrec(se->relevance, head);
for (n = root->children; n; n = n->next)
@@
-465,7
+475,7
@@
static struct record *ingest_record(struct client *cl, Z_External *rec)
}
else if (!strcmp(n->name, "metadata"))
{
}
else if (!strcmp(n->name, "metadata"))
{
- xmlChar *type = xmlGetProp(n, "type"), *value;
+ xmlChar *type = xmlGetProp(n, "type");
if (type && !strcmp(type, "title"))
{
xmlChar *value = xmlNodeListGetString(xdoc, n->children, 0);
if (type && !strcmp(type, "title"))
{
xmlChar *value = xmlNodeListGetString(xdoc, n->children, 0);
@@
-1159,9
+1169,7
@@
struct termlist_score **termlist(struct session *s, const char *name, int *num)
return 0;
}
return 0;
}
-#ifdef REPORT_NMEM
-// conditional compilation by SH: This lead to a warning with currently installed
-// YAZ header files on us1
+#ifdef MISSING_HEADERS
void report_nmem_stats(void)
{
size_t in_use, is_free;
void report_nmem_stats(void)
{
size_t in_use, is_free;