Avoid mix vardecl/stmt
[idzebra-moved-to-github.git] / test / api / testlib.c
index ba28301..e960d0d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: testlib.c,v 1.17 2005-05-03 09:07:17 adam Exp $
+/* $Id: testlib.c,v 1.19 2005-05-09 12:03:59 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -139,8 +139,8 @@ void init_data(ZebraHandle zh, const char **recs)
 
 }
 
-int do_query_x(int lineno, ZebraHandle zh, char *query, int exphits,
-             int experror)
+int do_query_x(int lineno, ZebraHandle zh, const char *query, zint exphits,
+              int experror)
 {
     ODR odr;
     YAZ_PQF_Parser parser;
@@ -163,13 +163,14 @@ int do_query_x(int lineno, ZebraHandle zh, char *query, int exphits,
     rc = zebra_search_RPN(zh, odr, rpn, setname, &hits);
     if (experror)
     {
+       int code;
        if (rc != ZEBRA_FAIL)
        {
            printf("Error: search returned %d (OK), but error was expected\n"
                   "%s\n",  rc, query);
            exit(1);
        }
-       int code = zebra_errCode(zh);
+       code = zebra_errCode(zh);
        if (code != experror)
        {
            printf("Error: search returned error code %d, but error %d was "
@@ -188,7 +189,7 @@ int do_query_x(int lineno, ZebraHandle zh, char *query, int exphits,
        }
        if (exphits != -1 && hits != exphits) {
            printf("Error: search returned " ZINT_FORMAT 
-                  " hits instead of %d\n%s\n",
+                  " hits instead of " ZINT_FORMAT "\n%s\n",
                   hits, exphits, query);
            exit (1);
        }
@@ -198,7 +199,7 @@ int do_query_x(int lineno, ZebraHandle zh, char *query, int exphits,
 }
 
 
-int do_query(int lineno, ZebraHandle zh, char *query, int exphits)
+int do_query(int lineno, ZebraHandle zh, const char *query, zint exphits)
 {
     return do_query_x(lineno, zh, query, exphits, 0);
 }