ZOOM_API(void)
ZOOM_connection_destroy(ZOOM_connection c)
{
+#if ZOOM_RESULT_LISTS
ZOOM_resultsets list;
+#else
+ ZOOM_resultset r;
+#endif
if (!c)
return;
yaz_log(log_api, "%p ZOOM_connection_destroy", c);
if (c->cs)
cs_close(c->cs);
+#if ZOOM_RESULT_LISTS
// Remove the connection's usage of resultsets
list = c->resultsets;
while (list) {
list = list->next;
xfree(removed);
}
+#else
+ for (r = c->resultsets; r; r = r->next)
+ r->connection = 0;
+#endif
xfree(c->buf_in);
xfree(c->addinfo);
const char *cp;
int start, count;
const char *syntax, *elementSetName;
+#if ZOOM_RESULT_LISTS
ZOOM_resultsets set;
+#endif
yaz_log(log_api, "%p ZOOM_connection_search set %p query %p", c, r, q);
r->r_sort_spec = q->sort_spec;
r->connection = c;
+#if ZOOM_RESULT_LISTS
yaz_log(log_details, "%p ZOOM_connection_search: Adding new resultset (%p) to resultsets (%p) ", c, r, c->resultsets);
set = xmalloc(sizeof(*set));
ZOOM_resultset_addref(r);
set->resultset = r;
set->next = c->resultsets;
c->resultsets = set;
-
+#else
+ r->next = c->resultsets;
+ c->resultsets = r;
+#endif
if (c->host_port && c->proto == PROTO_HTTP)
{
if (!c->cs)
yaz_log(log_details, "%p ZOOM_connection resultset_destroy: Deleting resultset (%p) ", r->connection, r);
ZOOM_resultset_cache_reset(r);
+#if ZOOM_RESULT_LISTS
+#else
+ if (r->connection)
+ {
+ /* remove ourselves from the resultsets in connection */
+ ZOOM_resultset *rp = &r->connection->resultsets;
+ while (1)
+ {
+ assert(*rp); /* we must be in this list!! */
+ if (*rp == r)
+ { /* OK, we're here - take us out of it */
+ *rp = (*rp)->next;
+ break;
+ }
+ rp = &(*rp)->next;
+ }
+ }
+#endif
ZOOM_query_destroy(r->query);
ZOOM_options_destroy(r->options);
odr_destroy(r->odr);
result sets on the server. */
for (ord = 1; ; ord++)
{
+#if ZOOM_RESULT_LISTS
ZOOM_resultsets rsp;
sprintf(setname, "%d", ord);
for (rsp = c->resultsets; rsp; rsp = rsp->next)
break;
if (!rsp)
break;
+#else
+ ZOOM_resultset rp;
+ sprintf(setname, "%d", ord);
+ for (rp = c->resultsets; rp; rp = rp->next)
+ if (rp->setname && !strcmp(rp->setname, setname))
+ break;
+ if (!rp)
+ break;
+#endif
+
}
r->setname = xstrdup(setname);
yaz_log(log_details, "%p ZOOM_connection_send_search: allocating "
#include <yaz/mutex.h>
#define SHPTR 1
+#define ZOOM_RESULT_LISTS 0
typedef struct ZOOM_Event_p *ZOOM_Event;
#define STATE_CONNECTING 1
#define STATE_ESTABLISHED 2
+#if ZOOM_RESULT_LISTS
typedef struct ZOOM_resultsets_p *ZOOM_resultsets;
+#endif
struct ZOOM_connection_p {
enum oid_proto proto;
ZOOM_task tasks;
ZOOM_options options;
+#if ZOOM_RESULT_LISTS
ZOOM_resultsets resultsets;
+#else
+ ZOOM_resultset resultsets;
+#endif
ZOOM_Event m_queue_front;
ZOOM_Event m_queue_back;
zoom_sru_mode sru_mode;
int no_redirects; /* 0 for no redirects. >0 for number of redirects */
};
+#if ZOOM_RESULT_LISTS
struct ZOOM_resultsets_p {
ZOOM_resultset resultset;
ZOOM_resultsets next;
};
-
+#endif
struct ZOOM_options_entry {
char *name;
#if SHPTR
struct WRBUF_shptr *record_wrbuf;
#endif
+#if ZOOM_RESULT_LISTS
+#else
+ ZOOM_resultset next;
+#endif
};
struct ZOOM_record_p {