Refactor access to global variable channel_list. There were a few
[pazpar2-moved-to-github.git] / src / database.c
index 0f18865..70e556a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: database.c,v 1.17 2007-04-12 10:17:53 marc Exp $
+/* $Id: database.c,v 1.19 2007-04-18 12:41:38 quinn Exp $
    Copyright (c) 2006-2007, Index Data.
 
 This file is part of Pazpar2.
@@ -227,19 +227,18 @@ static int match_criterion(struct setting **settings, struct database_criterion
         if (offset == PZ_ID)
         {
             if (match_zurl(settings[offset]->value, v->value))
-                return 1;
-            else
-                return 0;
+                break;
         }
         else 
         {
             if (!strcmp(settings[offset]->value, v->value))
-                return 1;
-            else
-                return 0;
+                break;
         }
     }
-    return 0;
+    if (v)
+        return 1;
+    else
+        return 0;
 }
 
 int database_match_criteria(struct setting **settings, struct database_criterion *cl)
@@ -329,8 +328,8 @@ static void prepare_yazmarc(void *ignore, struct database *db)
             yaz_marc_subfield_str(db->yaz_marc, "\t");
 
             // See if a native encoding is specified
-            if ((s = db->settings[PZ_ENCODING]))
-                encoding = s->value;
+            if (db->settings[PZ_ENCODING])
+                encoding = db->settings[PZ_ENCODING]->value;
             
             cm = yaz_iconv_open("utf-8", encoding);
             if (!cm)