Remove redundant function libxml2_error_to_yazlog
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 19 Jan 2010 08:45:06 +0000 (09:45 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 19 Jan 2010 08:45:06 +0000 (09:45 +0100)
Function libxml2_error_to_yazlog is redundant and not in used by
applications other than YAZ itself. yaz_log_xml_errors does the same -
and is used at least by Pazpar2.

include/yaz/Makefile.am
include/yaz/libxml2_error.h [deleted file]
src/Makefile.am
src/libxml2_error.c [deleted file]
test/tst_record_conv.c
test/tst_retrieval.c
win/makefile

index 0c10a06..246dbd8 100644 (file)
@@ -10,7 +10,7 @@ pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h rpn2cql.h comstack.h \
  readconf.h record_conv.h retrieval.h statserv.h \
  tcpip.h test.h timing.h unix.h tpath.h wrbuf.h xmalloc.h \
  yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
  readconf.h record_conv.h retrieval.h statserv.h \
  tcpip.h test.h timing.h unix.h tpath.h wrbuf.h xmalloc.h \
  yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
- xmlquery.h libxml2_error.h xmltypes.h snprintf.h query-charset.h \
+ xmlquery.h xmltypes.h snprintf.h query-charset.h \
  mutex.h oid_db.h oid_util.h oid_std.h tokenizer.h copy_types.h \
  icu.h match_glob.h poll.h daemon.h sc.h \
  \
  mutex.h oid_db.h oid_util.h oid_std.h tokenizer.h copy_types.h \
  icu.h match_glob.h poll.h daemon.h sc.h \
  \
diff --git a/include/yaz/libxml2_error.h b/include/yaz/libxml2_error.h
deleted file mode 100644 (file)
index d3b9a64..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of Index Data nor the names of its contributors
- *       may be used to endorse or promote products derived from this
- *       software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * \file libxml2_error.h
- * \brief Libxml2 error handler
- */
-
-#ifndef YAZ_LIBXML2_ERROR_H
-#define YAZ_LIBXML2_ERROR_H
-
-#include <stdio.h>
-#include <yaz/yconfig.h>
-
-YAZ_BEGIN_CDECL
-
-/** \brief direct Libxml2/Libxslt errors to yaz_log
-    \param level yaz_log level to use
-    \param lead_msg leading message (or NULL if none)
-    \retval 0 successful; libxml2 is present
-    \retval -1 failure; libxml2 is not present
-*/
-YAZ_EXPORT
-int libxml2_error_to_yazlog(int level, const char *lead_msg);
-
-YAZ_END_CDECL
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index 2e8107d..23eeeef 100644 (file)
@@ -82,7 +82,7 @@ libyaz_la_SOURCES=version.c options.c log.c \
   odr_null.c ber_null.c odr_int.c ber_int.c odr_tag.c odr_cons.c \
   odr_seq.c odr_oct.c ber_oct.c odr_bit.c ber_bit.c odr_oid.c \
   ber_oid.c odr_use.c odr_choice.c odr_any.c ber_any.c odr.c odr_mem.c \
   odr_null.c ber_null.c odr_int.c ber_int.c odr_tag.c odr_cons.c \
   odr_seq.c odr_oct.c ber_oct.c odr_bit.c ber_bit.c odr_oid.c \
   ber_oid.c odr_use.c odr_choice.c odr_any.c ber_any.c odr.c odr_mem.c \
-  dumpber.c odr_enum.c odr-priv.h libxml2_error.c \
+  dumpber.c odr_enum.c odr-priv.h \
   comstack.c tcpip.c waislen.c unix.c \
   prt-ext.c \
   ill-get.c \
   comstack.c tcpip.c waislen.c unix.c \
   prt-ext.c \
   ill-get.c \
diff --git a/src/libxml2_error.c b/src/libxml2_error.c
deleted file mode 100644 (file)
index 332c7af..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
- * See the file LICENSE for details.
- */
-/**
- * \file libxml2_error.c
- * \brief Libxml2 error handling
- */
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <yaz/log.h>
-#include <yaz/snprintf.h>
-#include <yaz/libxml2_error.h>
-
-#if YAZ_HAVE_XML2
-#include <libxml/xmlerror.h>
-#endif
-
-#if YAZ_HAVE_XSLT
-#include <libxslt/xsltutils.h>
-#endif
-
-static int libxml2_error_level = 0;
-
-#if YAZ_HAVE_XML2
-static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
-{
-    char buf[1024];
-
-    va_list ap;
-    va_start(ap, fmt);
-
-    yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-    yaz_log(libxml2_error_level, "%s: %s", (char*) ctx, buf);
-
-    va_end (ap);
-}
-#endif
-
-int libxml2_error_to_yazlog(int level, const char *lead_msg)
-{
-    libxml2_error_level = level;
-#if YAZ_HAVE_XML2
-    xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
-#if YAZ_HAVE_XSLT
-    xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
-#endif
-    return 0;
-#else
-    return -1;
-#endif
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index d1d1659..a8411f2 100644 (file)
@@ -334,7 +334,7 @@ static void tst_convert2(void)
 int main(int argc, char **argv)
 {
     YAZ_CHECK_INIT(argc, argv);
 int main(int argc, char **argv)
 {
     YAZ_CHECK_INIT(argc, argv);
-    libxml2_error_to_yazlog(0 /* disable log */, 0);
+    yaz_log_xml_errors(0, 0 /* disable log */);
 #if YAZ_HAVE_XML2
     tst_configure();
 #endif
 #if YAZ_HAVE_XML2
     tst_configure();
 #endif
index 71b085d..febc71d 100644 (file)
@@ -316,7 +316,7 @@ int main(int argc, char **argv)
 {
     YAZ_CHECK_INIT(argc, argv);
 
 {
     YAZ_CHECK_INIT(argc, argv);
 
-    libxml2_error_to_yazlog(0 /* disable it */, "");
+    yaz_log_xml_errors(0, 0 /* disable it */);
 
 #if YAZ_HAVE_XSLT
     tst_configure();
 
 #if YAZ_HAVE_XSLT
     tst_configure();
index 1f26ef2..3815beb 100644 (file)
@@ -444,7 +444,6 @@ MISC_OBJS= \
    $(OBJDIR)\iso5426.obj \
    $(OBJDIR)\record_conv.obj \
    $(OBJDIR)\retrieval.obj \
    $(OBJDIR)\iso5426.obj \
    $(OBJDIR)\record_conv.obj \
    $(OBJDIR)\retrieval.obj \
-   $(OBJDIR)\libxml2_error.obj \
    $(OBJDIR)\test.obj \
    $(OBJDIR)\diagbib1.obj \
    $(OBJDIR)\diagsru_update.obj \
    $(OBJDIR)\test.obj \
    $(OBJDIR)\diagbib1.obj \
    $(OBJDIR)\diagsru_update.obj \