Build for Ubuntu precise, no build for maverick
[idzebra-moved-to-github.git] / index / mod_grs_xml.c
index 248342b..7df0f32 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the Zebra server.
-   Copyright (C) 1995-2008 Index Data
+   Copyright (C) 1994-2011 Index Data
 
 Zebra is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #if HAVE_EXPAT_H
 
 #include <assert.h>
@@ -46,6 +49,14 @@ struct user_info {
     int loglevel;
 };
 
+static void report_xml_error(XML_Parser parser)
+{
+    zint line = XML_GetCurrentLineNumber(parser);
+    zint col = XML_GetCurrentColumnNumber(parser);
+    yaz_log (YLOG_WARN, ZINT_FORMAT ":" ZINT_FORMAT ":XML error: %s",
+             line, col, XML_ErrorString(XML_GetErrorCode(parser)));
+}
+
 static void cb_start (void *user, const char *el, const char **attr)
 {
     struct user_info *ui = (struct user_info*) user;
@@ -199,11 +210,7 @@ static int cb_external_entity(XML_Parser pparser,
         if (!XML_ParseBuffer (parser, r, done))
         {
            done = 1;
-           yaz_log (YLOG_WARN, "%s:%d:%d:XML error: %s",
-                    systemId,
-                    XML_GetCurrentLineNumber(parser),
-                    XML_GetCurrentColumnNumber(parser),
-                    XML_ErrorString(XML_GetErrorCode(parser)));
+            report_xml_error(parser);
        }
     }
     fclose (inf);
@@ -446,10 +453,7 @@ data1_node *zebra_read_xml(data1_handle dh,
         if (no_read && !XML_ParseBuffer (parser, r, done))
         {
            done = 1;
-           yaz_log (YLOG_WARN, "%d:%d:XML error: %s",
-                    XML_GetCurrentLineNumber(parser),
-                    XML_GetCurrentColumnNumber(parser),
-                    XML_ErrorString(XML_GetErrorCode(parser)));
+            report_xml_error(parser);
        }
     }
     XML_ParserFree (parser);
@@ -524,7 +528,7 @@ static struct recType filter_type = {
 };
 
 RecType
-#ifdef IDZEBRA_STATIC_GRS_XML
+#if IDZEBRA_STATIC_GRS_XML
 idzebra_filter_grs_xml
 #else
 idzebra_filter
@@ -540,6 +544,7 @@ idzebra_filter
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab