Avoid buffer[length] construct in yaz-ztest
[yaz-moved-to-github.git] / ztest / ztest.c
index 69a8786..50872a3 100644 (file)
@@ -232,7 +232,7 @@ static void addterms(ODR odr, Z_FacetField *facet_field, const char *facet_name)
     int index;
     int freq = 100;
     int length = strlen(facet_name) + 10;
-    char key[length];
+    char *key = odr_malloc(odr, length);
     key[0] = '\0';
     for (index = 0; index < facet_field->num_terms; index++) {
         Z_Term *term;
@@ -396,9 +396,7 @@ int ztest_search(void *handle, bend_search_rr *rr)
 
     if (1)
     {
-        /* TODO Not general. Only handles one (Facet) OtherInformation. Overwrite  */
-        Z_FacetList *facet_list = extract_facet_request(rr->stream, rr->search_input);
-
+        Z_FacetList *facet_list = yaz_oi_get_facetlist(&rr->search_input);
         if (facet_list) {
             yaz_log(YLOG_LOG, "%d Facets in search request.", facet_list->num);
             rr->search_info = build_facet_response(rr->stream, facet_list);