From b56b6242e4e9c0011b9a2dae6d67c3ef0789251f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 3 Aug 2010 13:32:54 +0200 Subject: [PATCH] Rename attr facet specific functions --- client/client.c | 2 +- include/yaz/facet.h | 18 +++--------------- src/facet.c | 13 +++++++------ src/zoom-c.c | 4 ++-- ztest/ztest.c | 5 +++-- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/client/client.c b/client/client.c index 4b6ad19..a3442dc 100644 --- a/client/client.c +++ b/client/client.c @@ -1655,7 +1655,7 @@ static void display_facet(Z_FacetField *facet) { attr_values.useattr = 0; attr_values.relation = "default"; - facetattrs(al, &attr_values); + yaz_facet_attr_get_z_attributes(al, &attr_values); if (!attr_values.errcode) { int term_index; printf(" %s (%d): \n", attr_values.useattr, /* attr_values.relation, attr_values.limit, */ facet->num_terms); diff --git a/include/yaz/facet.h b/include/yaz/facet.h index 3f21374..8a22208 100644 --- a/include/yaz/facet.h +++ b/include/yaz/facet.h @@ -62,23 +62,11 @@ struct yaz_facet_attr { }; YAZ_EXPORT -void facet_struct_init(struct yaz_facet_attr *attr_values); +void yaz_facet_attr_init(struct yaz_facet_attr *attr_values); -/* Use attribute, @attr1, can be numeric or string */ YAZ_EXPORT -void useattr(Z_AttributeElement *ae, struct yaz_facet_attr *av); - -YAZ_EXPORT -void relationattr(Z_AttributeElement *ae, struct yaz_facet_attr *av); - -YAZ_EXPORT -void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av); - -YAZ_EXPORT -void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av); - -YAZ_EXPORT -void facetattrs(Z_AttributeList *attributes, struct yaz_facet_attr *av); +void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes, + struct yaz_facet_attr *av); YAZ_EXPORT Z_FacetList *extract_facet_request(ODR odr, Z_OtherInformation *search_input); diff --git a/src/facet.c b/src/facet.c index 82a8365..13d1566 100644 --- a/src/facet.c +++ b/src/facet.c @@ -23,7 +23,7 @@ /* Gets the first string, there is usually only one */ /* in case of errors, returns null */ -void facet_struct_init(struct yaz_facet_attr *attr_values) +void yaz_facet_attr_init(struct yaz_facet_attr *attr_values) { attr_values->errcode = 0; attr_values->errstring = 0; @@ -33,7 +33,7 @@ void facet_struct_init(struct yaz_facet_attr *attr_values) attr_values->limit = 0; } -const char *stringattr(Z_ComplexAttribute *c) +static const char *stringattr(Z_ComplexAttribute *c) { int i; Z_StringOrNumeric *son; @@ -47,7 +47,7 @@ const char *stringattr(Z_ComplexAttribute *c) } /* Use attribute, @attr1, can be numeric or string */ -void useattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) +static void useattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) { const char *s; if (ae->which == Z_AttributeValue_complex) @@ -79,7 +79,7 @@ void useattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) /* TODO rename to sortorder attr */ -void relationattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) +static void relationattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) { if (ae->which == Z_AttributeValue_numeric) { @@ -104,7 +104,7 @@ void relationattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) } } /* relationattr */ -void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) +static void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) { if (ae->which == Z_AttributeValue_numeric) { @@ -128,7 +128,8 @@ void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av) so no need to free that string! */ -void facetattrs(Z_AttributeList *attributes, struct yaz_facet_attr *av) +void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes, + struct yaz_facet_attr *av) { int i; Z_AttributeElement *ae; diff --git a/src/zoom-c.c b/src/zoom-c.c index aa94b8e..4ed5d8d 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2697,8 +2697,8 @@ static ZOOM_facet_field get_zoom_facet_field(ODR odr, Z_FacetField *facet) { int term_index; struct yaz_facet_attr attr_values; ZOOM_facet_field facet_field = odr_malloc(odr, sizeof(*facet_field)); - memset(&attr_values, 0, sizeof(attr_values)); - facetattrs(facet->attributes, &attr_values); + yaz_facet_attr_init(&attr_values); + yaz_facet_attr_get_z_attributes(facet->attributes, &attr_values); facet_field->facet_name = odr_strdup(odr, attr_values.useattr); facet_field->num_terms = facet->num_terms; yaz_log(YLOG_DEBUG, "ZOOM_facet_field %s %d terms %d", attr_values.useattr, attr_values.limit, facet->num_terms); diff --git a/ztest/ztest.c b/ztest/ztest.c index c786d89..69a8786 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -252,9 +252,10 @@ Z_OtherInformation *build_facet_response(ODR odr, Z_FacetList *facet_list) { for (index = 0; index < facet_list->num; index++) { struct yaz_facet_attr attrvalues; - facet_struct_init(&attrvalues); + yaz_facet_attr_init(&attrvalues); attrvalues.limit = 10; - facetattrs(facet_list->elements[index]->attributes, &attrvalues); + yaz_facet_attr_get_z_attributes(facet_list->elements[index]->attributes, + &attrvalues); yaz_log(YLOG_LOG, "Attributes: %s %d ", attrvalues.useattr, attrvalues.limit); if (attrvalues.errstring) yaz_log(YLOG_LOG, "Error parsing attributes: %s", attrvalues.errstring); -- 1.7.10.4