From 192c53b56174fa2d80db61029ba95bfa2a1a480a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 30 Jan 2014 13:50:10 +0100 Subject: [PATCH] ZOOM: resultset setname managed by ODR --- src/zoom-c.c | 18 +++++++----------- src/zoom-sru.c | 2 +- src/zoom-z3950.c | 7 +++---- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/zoom-c.c b/src/zoom-c.c index 383b344..3d38105 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -721,10 +721,9 @@ ZOOM_API(ZOOM_resultset) ZOOM_connection_search(ZOOM_connection c, ZOOM_query q) { ZOOM_resultset r = ZOOM_resultset_create(); - const char *cp; ZOOM_task task; int start, count; - const char *syntax, *elementSetName, *schema, *facets; + const char *syntax, *elementSetName, *schema; yaz_log(c->log_api, "%p ZOOM_connection_search set %p query %p", c, r, q); r->r_sort_spec = ZOOM_query_get_sortspec(q); r->query = q; @@ -732,7 +731,7 @@ ZOOM_API(ZOOM_resultset) r->options = ZOOM_options_create_with_parent(c->options); - r->req_facets = odr_strdup_null(r->odr, + r->req_facets = odr_strdup_null(r->odr, ZOOM_options_get(r->options, "facets")); start = ZOOM_options_get_int(r->options, "start", 0); count = ZOOM_options_get_int(r->options, "count", 0); @@ -743,13 +742,11 @@ ZOOM_API(ZOOM_resultset) (cp != 0 ? "presentChunk": "step"), 0); } r->piggyback = ZOOM_options_get_bool(r->options, "piggyback", 1); - cp = ZOOM_options_get(r->options, "setname"); - if (cp) - r->setname = xstrdup(cp); - - r->databaseNames = ZOOM_connection_get_databases(c, c->options, &r->num_databaseNames, - r->odr); - + r->setname = odr_strdup_null(r->odr, + ZOOM_options_get(r->options, "setname")); + r->databaseNames = ZOOM_connection_get_databases(c, c->options, + &r->num_databaseNames, + r->odr); r->connection = c; r->next = c->resultsets; c->resultsets = r; @@ -872,7 +869,6 @@ static void resultset_destroy(ZOOM_resultset r) ZOOM_query_destroy(r->query); ZOOM_options_destroy(r->options); odr_destroy(r->odr); - xfree(r->setname); yaz_mutex_destroy(&r->mutex); #if SHPTR YAZ_SHPTR_DEC(r->record_wrbuf, wrbuf_destroy); diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 533c1df..fd0c2bc 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -165,7 +165,7 @@ zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c) ZOOM_memcached_search(c, resultset); if (!resultset->setname) - resultset->setname = xstrdup("default"); + resultset->setname = odr_strdup(resultset->odr, "default"); ZOOM_options_set(resultset->options, "setname", resultset->setname); start = &c->tasks->u.search.start; count = &c->tasks->u.search.count; diff --git a/src/zoom-z3950.c b/src/zoom-z3950.c index a65b54f..b082108 100644 --- a/src/zoom-z3950.c +++ b/src/zoom-z3950.c @@ -645,7 +645,6 @@ static zoom_ret Z3950_send_search(ZOOM_connection c) const char *elementSetName; const char *smallSetElementSetName; const char *mediumSetElementSetName; - const char *facets; assert(c->tasks); assert(c->tasks->which == ZOOM_TASK_SEARCH); @@ -678,7 +677,7 @@ static zoom_ret Z3950_send_search(ZOOM_connection c) yaz_oi_set_facetlist(oi, c->odr_out, facet_list); } else - yaz_log(YLOG_WARN, "Unable to parse facets: %s", facets); + yaz_log(YLOG_WARN, "Unable to parse facets: %s", r->req_facets); } assert(r); @@ -790,7 +789,7 @@ static zoom_ret Z3950_send_search(ZOOM_connection c) if (!rp) break; } - r->setname = xstrdup(setname); + r->setname = odr_strdup(r->odr, setname); yaz_log(c->log_details, "%p ZOOM_connection_send_search: " "allocating set %s", c, r->setname); } @@ -798,7 +797,7 @@ static zoom_ret Z3950_send_search(ZOOM_connection c) { yaz_log(c->log_details, "%p ZOOM_connection_send_search: using " "default set", c); - r->setname = xstrdup("default"); + r->setname = odr_strdup(r->odr, "default"); } ZOOM_options_set(r->options, "setname", r->setname); } -- 1.7.10.4