Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/pazpar2
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 21 May 2010 09:49:04 +0000 (11:49 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 21 May 2010 09:49:04 +0000 (11:49 +0200)
etc/opac_turbomarc.xsl
src/client.c
src/session.c

index 4c3fe80..83d2319 100644 (file)
       </pz:metadata>
     </xsl:for-each>
   </xsl:template>
-
   <xsl:template match="/">
-    <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
+    <xsl:choose>
+      <xsl:when test="opacRecord">
+        <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
 </xsl:stylesheet>
index 2ebab5e..064754a 100644 (file)
@@ -78,7 +78,7 @@ static void client_use(int delta)
     yaz_mutex_enter(g_mutex);
     no_clients += delta;
     yaz_mutex_leave(g_mutex);
-    yaz_log(YLOG_LOG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients);
+    yaz_log(YLOG_DEBUG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients);
 }
 #else
 #define client_use(x)
@@ -638,7 +638,7 @@ void client_unlock(struct client *c)
 void client_incref(struct client *c)
 {
     pazpar2_incref(&c->ref_count, c->mutex);
-    yaz_log(YLOG_LOG, "client_incref c=%p %s cnt=%d",
+    yaz_log(YLOG_DEBUG, "client_incref c=%p %s cnt=%d",
             c, client_get_url(c), c->ref_count);
 }
 
@@ -646,7 +646,7 @@ int client_destroy(struct client *c)
 {
     if (c)
     {
-        yaz_log(YLOG_LOG, "client_destroy c=%p %s cnt=%d",
+        yaz_log(YLOG_DEBUG, "client_destroy c=%p %s cnt=%d",
                 c, client_get_url(c), c->ref_count);
         if (!pazpar2_decref(&c->ref_count, c->mutex))
         {
index 5302971..61f7e54 100644 (file)
@@ -981,7 +981,10 @@ static int get_mergekey_from_doc(xmlDoc *doc, xmlNode *root, const char *name,
         if (!strcmp((const char *) n->name, "metadata"))
         {
             xmlChar *type = xmlGetProp(n, (xmlChar *) "type");
-            if (!strcmp(name, (const char *) type))
+            if (type == NULL) {
+                yaz_log(YLOG_FATAL, "Missing type attribute on metadata element. Skipping!");
+            }
+            else if (!strcmp(name, (const char *) type))
             {
                 xmlChar *value = xmlNodeListGetString(doc, n->children, 1);
                 if (value)