Re: [xml] interaction between xmlSetGenericErrorFunc and xmlSetStructuredErrorFunc can crash (draft patch available)




On 07/29/2009 03:03 AM, Daniel Veillard wrote:

On Mon, Jul 27, 2009 at 08:05:37PM -0700, Wang Lam wrote:
:
(b) Worse than being invoked, though, the default xmlGenericError
    crashed (instead of, say, printing to stderr).

    From what I see, xmlGenericErrorFunc and xmlStructuredErrorFunc
    share a single xmlGenericErrorContext; setting one function
    overwrites the other function's context.  In the above example
:
  yes, I agree with the diagnostic, I came up to the same conclusion,
this need fixing !

    With a patch to create xmlStructuredErrorContext, I get a different
    result from the above example code:

  yes, I think I know what you patch does, add the new variable in
  globals.c, initialize it properly, and use it for the strcutured
  error paths in error.c
:
  yes please or just reply with the attached patch, I expect to do
  libxml2 maintainace today and tomorrow !

Please find my (slightly edited) `git diff` output attached.

Just a warning--the diff also contains a few side-effect diffs from the
implementation that you may want to review or edit:

* It seems that globals were intended to go into global.data, then fed
  through a code-generator (build_glob.py) to generate globals.{h,c}.
  Unfortunately, the output of global.data + build_glob.py and the
  checked-in snapshot of the globals.* output files seem to have
  diverged at some point.

  I tried to reconcile most of the differences, but a few remain (mainly
  the way declarations are automatically written in globals.h, and some
  use of #ifdef LIBXML_SAX1_ENABLED in globals.c).

* I didn't check the generated HTML output at all, though there seemed
  to be a few changes there generated from an underlying diff in
  libxml2-api.xml.

* I removed a few files' changes where the changes didn't seem directly
  related to xmlSetStructuredErrorFunc at all (namely: config.h.in,
  xmlcatalog.1, and xmllint.1).  I'd be happy to mail these diffs to you
  if you'd like; they look like they're just artifacts of a slightly
  different build environment, though.

In short, my cursory understanding of the source tree suggests that
libxml2-api.xml, error.c, global.data, and globals.* (above their
respective autogeneration-starts-here lines) are the only diffs that
are "supposed" to matter, but a few more popped out anyway...

I hope this diff is helpful.  If you encounter any trouble with it,
please drop me a line so that I can see what I can figure out.

Wang Lam
diff --git a/doc/devhelp/libxml2-globals.html b/doc/devhelp/libxml2-globals.html
index 449049e..43c0502 100644
--- a/doc/devhelp/libxml2-globals.html
+++ b/doc/devhelp/libxml2-globals.html
@@ -96,6 +96,7 @@ const char *  <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
     <a href="libxml2-xmlerror.html#xmlGenericErrorFunc">xmlGenericErrorFunc</a>        xmlGenericError
     <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a>  xmlStructuredError
     void *     xmlGenericErrorContext
+    void *     xmlStructuredErrorContext
     int        oldXMLWDcompatibility
     <a href="libxml2-tree.html#xmlBufferAllocationScheme">xmlBufferAllocationScheme</a>        
xmlBufferAllocScheme
     int        xmlDefaultBufferSize
@@ -260,6 +261,10 @@ const char *       <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 </pre><p/>
 </div>
         <hr/>
+        <div class="refsect2" lang="en"><h3><a name="xmlStructuredErrorContext">Variable 
</a>xmlStructuredErrorContext</h3><pre class="programlisting">void * xmlStructuredErrorContext;
+</pre><p/>
+</div>
+        <hr/>
         <div class="refsect2" lang="en"><h3><a name="xmlSubstituteEntitiesDefaultValue">Variable 
</a>xmlSubstituteEntitiesDefaultValue</h3><pre class="programlisting">int xmlSubstituteEntitiesDefaultValue;
 </pre><p/>
 </div>
diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp
index ce525af..932a985 100644
--- a/doc/devhelp/libxml2.devhelp
+++ b/doc/devhelp/libxml2.devhelp
@@ -1909,6 +1909,7 @@
     <function name="xmlStringText" link="libxml2-parserInternals.html#xmlStringText"/>
     <function name="xmlStringTextNoenc" link="libxml2-parserInternals.html#xmlStringTextNoenc"/>
     <function name="xmlStructuredError" link="libxml2-globals.html#xmlStructuredError"/>
+    <function name="xmlStructuredErrorContext" link="libxml2-globals.html#xmlStructuredErrorContext"/>
     <function name="xmlSubstituteEntitiesDefaultValue" 
link="libxml2-globals.html#xmlSubstituteEntitiesDefaultValue"/>
     <function name="xmlTreeIndentString" link="libxml2-globals.html#xmlTreeIndentString"/>
     <function name="xmlXPathNAN" link="libxml2-xpath.html#xmlXPathNAN"/>
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index af077c9..5181ac6 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -481,6 +481,7 @@
      <exports symbol='xmlMalloc' type='variable'/>
      <exports symbol='xmlParserVersion' type='variable'/>
      <exports symbol='xmlStructuredError' type='variable'/>
+     <exports symbol='xmlStructuredErrorContext' type='variable'/>
      <exports symbol='xmlDoValidityCheckingDefaultValue' type='variable'/>
      <exports symbol='xmlOutputBufferCreateFilenameValue' type='variable'/>
      <exports symbol='xmlPedanticParserDefaultValue' type='variable'/>
@@ -6131,6 +6132,7 @@ set at the end of parsing'/>
       <field name='xmlGenericError' type='xmlGenericErrorFunc' info=''/>
       <field name='xmlStructuredError' type='xmlStructuredErrorFunc' info=''/>
       <field name='xmlGenericErrorContext' type='void *' info=''/>
+      <field name='xmlStructuredErrorContext' type='void *' info=''/>
       <field name='oldXMLWDcompatibility' type='int' info=''/>
       <field name='xmlBufferAllocScheme' type='xmlBufferAllocationScheme' info=''/>
       <field name='xmlDefaultBufferSize' type='int' info=''/>
@@ -6892,6 +6894,7 @@ Could we use @subtypes for this?'/>
     <variable name='xmlStringText' file='parserInternals' type='const xmlCharxmlStringText[]'/>
     <variable name='xmlStringTextNoenc' file='parserInternals' type='const xmlCharxmlStringTextNoenc[]'/>
     <variable name='xmlStructuredError' file='globals' type='xmlStructuredErrorFunc'/>
+    <variable name='xmlStructuredErrorContext' file='globals' type='void *'/>
     <variable name='xmlSubstituteEntitiesDefaultValue' file='globals' type='int'/>
     <variable name='xmlTreeIndentString' file='globals' type='const char *'/>
     <variable name='xmlXPathNAN' file='xpath' type='double'/>
diff --git a/error.c b/error.c
index 9ec0286..c972b77 100644
--- a/error.c
+++ b/error.c
@@ -132,7 +132,7 @@ xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
  */
 void
 xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
-    xmlGenericErrorContext = ctx;
+    xmlStructuredErrorContext = ctx;
     xmlStructuredError = handler;
 }
 
@@ -471,7 +471,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
         * if user has defined handler, change data ptr to user's choice
         */
        if (schannel != NULL)
-           data = xmlGenericErrorContext;
+           data = xmlStructuredErrorContext;
     }
     if ((domain == XML_FROM_VALID) &&
         ((channel == xmlParserValidityError) ||
@@ -600,13 +600,15 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
            channel = ctxt->sax->error;
        data = ctxt->userData;
     } else if (channel == NULL) {
-        if ((schannel == NULL) && (xmlStructuredError != NULL))
+        if ((schannel == NULL) && (xmlStructuredError != NULL)) {
            schannel = xmlStructuredError;
-       else
+           data = xmlStructuredErrorContext;
+       } else {
            channel = xmlGenericError;
-       if (!data) {
-            data = xmlGenericErrorContext;
-    }
+           if (!data) {
+               data = xmlGenericErrorContext;
+           }
+       }
     }
     if (schannel != NULL) {
         schannel(data, to);
diff --git a/global.data b/global.data
index 1a8c8a7..519519a 100644
--- a/global.data
+++ b/global.data
@@ -2,11 +2,13 @@
 int,oldXMLWDcompatibility,,
 xmlBufferAllocationScheme,xmlBufferAllocScheme,,1
 int,xmlDefaultBufferSize,,1
-xmlSAXHandler,xmlDefaultSAXHandler,,
+xmlSAXHandlerV1,xmlDefaultSAXHandler,,
 xmlSAXLocator,xmlDefaultSAXLocator,,
 int,xmlDoValidityCheckingDefaultValue,,1
 xmlGenericErrorFunc,xmlGenericError,,
+xmlStructuredErrorFunc,xmlStructuredError,,
 void *,xmlGenericErrorContext,,
+void *,xmlStructuredErrorContext,,
 int,xmlGetWarningsDefaultValue,,1
 int,xmlIndentTreeOutput,,1
 const char *,xmlTreeIndentString,,1
@@ -23,3 +25,5 @@ int,xmlSaveNoEmptyTags,,1
 int,xmlSubstituteEntitiesDefaultValue,,1
 xmlRegisterNodeFunc,xmlRegisterNodeDefaultValue,,
 xmlDeregisterNodeFunc,xmlDeregisterNodeDefaultValue,,
+xmlParserInputBufferCreateFilenameFunc,xmlParserInputBufferCreateFilenameValue,,
+xmlOutputBufferCreateFilenameFunc,xmlOutputBufferCreateFilenameValue,,
diff --git a/globals.c b/globals.c
index cbc6625..5b1c4dd 100644
--- a/globals.c
+++ b/globals.c
@@ -148,6 +148,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
 #undef xmlGenericError
 #undef xmlStructuredError
 #undef xmlGenericErrorContext
+#undef xmlStructuredErrorContext
 #undef xmlGetWarningsDefaultValue
 #undef xmlIndentTreeOutput
 #undef  xmlTreeIndentString
@@ -314,6 +315,13 @@ static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
  */
 void *xmlGenericErrorContext = NULL;
 static void *xmlGenericErrorContextThrDef = NULL;
+/**
+ * xmlStructuredErrorContext:
+ *
+ * Global setting passed to structured error callbacks
+ */
+void *xmlStructuredErrorContext = NULL;
+static void *xmlStructuredErrorContextThrDef = NULL;
 xmlError xmlLastError;
 
 /*
@@ -545,6 +553,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
     gs->xmlGenericError = xmlGenericErrorThrDef;
     gs->xmlStructuredError = xmlStructuredErrorThrDef;
     gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
+    gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
     gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
     gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
 
@@ -573,7 +582,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
 void
 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
     xmlMutexLock(xmlThrDefMutex);
-    xmlGenericErrorContextThrDef = ctx;
+    xmlStructuredErrorContextThrDef = ctx;
     xmlStructuredErrorThrDef = handler;
     xmlMutexUnlock(xmlThrDefMutex);
 }
@@ -812,7 +821,6 @@ int xmlThrDefDefaultBufferSize(int v) {
     return ret;
 }
 
-#ifdef LIBXML_SAX1_ENABLED
 #undef xmlDefaultSAXHandler
 xmlSAXHandlerV1 *
 __xmlDefaultSAXHandler(void) {
@@ -821,7 +829,6 @@ __xmlDefaultSAXHandler(void) {
     else
        return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
 }
-#endif /* LIBXML_SAX1_ENABLED */
 
 #undef xmlDefaultSAXLocator
 xmlSAXLocator *
@@ -876,6 +883,15 @@ __xmlGenericErrorContext(void) {
        return (&xmlGetGlobalState()->xmlGenericErrorContext);
 }
 
+#undef xmlStructuredErrorContext
+void * *
+__xmlStructuredErrorContext(void) {
+    if (IS_MAIN_THREAD)
+       return (&xmlStructuredErrorContext);
+    else
+       return (&xmlGetGlobalState()->xmlStructuredErrorContext);
+}
+
 #undef xmlGetWarningsDefaultValue
 int *
 __xmlGetWarningsDefaultValue(void) {
@@ -910,7 +926,7 @@ int xmlThrDefIndentTreeOutput(int v) {
     return ret;
 }
 
-#undef xmlTreeIndentString
+#undef xmlTreeIndentString
 const char * *
 __xmlTreeIndentString(void) {
     if (IS_MAIN_THREAD)
diff --git a/include/libxml/globals.h b/include/libxml/globals.h
index 57e25fa..c2c3e08 100644
--- a/include/libxml/globals.h
+++ b/include/libxml/globals.h
@@ -76,6 +76,7 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc
 #undef xmlGenericError
 #undef xmlStructuredError
 #undef xmlGenericErrorContext
+#undef xmlStructuredErrorContext
 #undef xmlGetWarningsDefaultValue
 #undef xmlIndentTreeOutput
 #undef  xmlTreeIndentString
@@ -131,6 +132,7 @@ struct _xmlGlobalState
        xmlGenericErrorFunc xmlGenericError;
        xmlStructuredErrorFunc xmlStructuredError;
        void *xmlGenericErrorContext;
+       void *xmlStructuredErrorContext;
 
        int oldXMLWDcompatibility;
 
@@ -279,209 +281,217 @@ XMLPUBVAR xmlError xmlLastError;
  */
 
 
-XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
+extern int *__oldXMLWDcompatibility(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define oldXMLWDcompatibility \
 (*(__oldXMLWDcompatibility()))
 #else
-XMLPUBVAR int oldXMLWDcompatibility;
+LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;
 #endif
 
-XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
+extern xmlBufferAllocationScheme *__xmlBufferAllocScheme(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlBufferAllocScheme \
 (*(__xmlBufferAllocScheme()))
 #else
-XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
+LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme;
 #endif
-XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
+xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
 
-XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
+extern int *__xmlDefaultBufferSize(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultBufferSize \
 (*(__xmlDefaultBufferSize()))
 #else
-XMLPUBVAR int xmlDefaultBufferSize;
+LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
+int xmlThrDefDefaultBufferSize(int v);
 
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
+extern xmlSAXHandlerV1 *__xmlDefaultSAXHandler(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXHandler \
 (*(__xmlDefaultSAXHandler()))
 #else
-XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
+LIBXML_DLL_IMPORT extern xmlSAXHandlerV1 xmlDefaultSAXHandler;
 #endif
 
-XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
+extern xmlSAXLocator *__xmlDefaultSAXLocator(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXLocator \
 (*(__xmlDefaultSAXLocator()))
 #else
-XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
+LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
+extern int *__xmlDoValidityCheckingDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDoValidityCheckingDefaultValue \
 (*(__xmlDoValidityCheckingDefaultValue()))
 #else
-XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
+int xmlThrDefDoValidityCheckingDefaultValue(int v);
 
-XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
+extern xmlGenericErrorFunc *__xmlGenericError(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericError \
 (*(__xmlGenericError()))
 #else
-XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
+LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
 #endif
 
-XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
+extern xmlStructuredErrorFunc *__xmlStructuredError(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlStructuredError \
 (*(__xmlStructuredError()))
 #else
-XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
+LIBXML_DLL_IMPORT extern xmlStructuredErrorFunc xmlStructuredError;
 #endif
 
-XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
+extern void * *__xmlGenericErrorContext(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericErrorContext \
 (*(__xmlGenericErrorContext()))
 #else
-XMLPUBVAR void * xmlGenericErrorContext;
+LIBXML_DLL_IMPORT extern void * xmlGenericErrorContext;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
+extern void * *__xmlStructuredErrorContext(void);
+#ifdef LIBXML_THREAD_ENABLED
+#define xmlStructuredErrorContext \
+(*(__xmlStructuredErrorContext()))
+#else
+LIBXML_DLL_IMPORT extern void * xmlStructuredErrorContext;
+#endif
+
+extern int *__xmlGetWarningsDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGetWarningsDefaultValue \
 (*(__xmlGetWarningsDefaultValue()))
 #else
-XMLPUBVAR int xmlGetWarningsDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
+int xmlThrDefGetWarningsDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
+extern int *__xmlIndentTreeOutput(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlIndentTreeOutput \
 (*(__xmlIndentTreeOutput()))
 #else
-XMLPUBVAR int xmlIndentTreeOutput;
+LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
+int xmlThrDefIndentTreeOutput(int v);
 
-XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
+extern const char * *__xmlTreeIndentString(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlTreeIndentString \
 (*(__xmlTreeIndentString()))
 #else
-XMLPUBVAR const char * xmlTreeIndentString;
+LIBXML_DLL_IMPORT extern const char * xmlTreeIndentString;
 #endif
-XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
+const char * xmlThrDefTreeIndentString(const char * v);
 
-XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
+extern int *__xmlKeepBlanksDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlKeepBlanksDefaultValue \
 (*(__xmlKeepBlanksDefaultValue()))
 #else
-XMLPUBVAR int xmlKeepBlanksDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
+int xmlThrDefKeepBlanksDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
+extern int *__xmlLineNumbersDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLineNumbersDefaultValue \
 (*(__xmlLineNumbersDefaultValue()))
 #else
-XMLPUBVAR int xmlLineNumbersDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlLineNumbersDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
+int xmlThrDefLineNumbersDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
+extern int *__xmlLoadExtDtdDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLoadExtDtdDefaultValue \
 (*(__xmlLoadExtDtdDefaultValue()))
 #else
-XMLPUBVAR int xmlLoadExtDtdDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
+int xmlThrDefLoadExtDtdDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
+extern int *__xmlParserDebugEntities(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserDebugEntities \
 (*(__xmlParserDebugEntities()))
 #else
-XMLPUBVAR int xmlParserDebugEntities;
+LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
+int xmlThrDefParserDebugEntities(int v);
 
-XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
+extern const char * *__xmlParserVersion(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserVersion \
 (*(__xmlParserVersion()))
 #else
-XMLPUBVAR const char * xmlParserVersion;
+LIBXML_DLL_IMPORT extern const char * xmlParserVersion;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
+extern int *__xmlPedanticParserDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlPedanticParserDefaultValue \
 (*(__xmlPedanticParserDefaultValue()))
 #else
-XMLPUBVAR int xmlPedanticParserDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
+int xmlThrDefPedanticParserDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
+extern int *__xmlSaveNoEmptyTags(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSaveNoEmptyTags \
 (*(__xmlSaveNoEmptyTags()))
 #else
-XMLPUBVAR int xmlSaveNoEmptyTags;
+LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
+int xmlThrDefSaveNoEmptyTags(int v);
 
-XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
+extern int *__xmlSubstituteEntitiesDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSubstituteEntitiesDefaultValue \
 (*(__xmlSubstituteEntitiesDefaultValue()))
 #else
-XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
+int xmlThrDefSubstituteEntitiesDefaultValue(int v);
 
-XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
+extern xmlRegisterNodeFunc *__xmlRegisterNodeDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlRegisterNodeDefaultValue \
 (*(__xmlRegisterNodeDefaultValue()))
 #else
-XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
+LIBXML_DLL_IMPORT extern xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
 #endif
 
-XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
+extern xmlDeregisterNodeFunc *__xmlDeregisterNodeDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDeregisterNodeDefaultValue \
 (*(__xmlDeregisterNodeDefaultValue()))
 #else
-XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
+LIBXML_DLL_IMPORT extern xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
 #endif
 
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void);
+extern xmlParserInputBufferCreateFilenameFunc *__xmlParserInputBufferCreateFilenameValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserInputBufferCreateFilenameValue \
 (*(__xmlParserInputBufferCreateFilenameValue()))
 #else
-XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
+LIBXML_DLL_IMPORT extern xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
 #endif
 
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
+extern xmlOutputBufferCreateFilenameFunc *__xmlOutputBufferCreateFilenameValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlOutputBufferCreateFilenameValue \
 (*(__xmlOutputBufferCreateFilenameValue()))
 #else
-XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
+LIBXML_DLL_IMPORT extern xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
 #endif
 
 #ifdef __cplusplus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]