[libxml2] Add xmlPopOutputCallbacks



commit c2e09f445cd201e12e7db5c6428c36296dd0f577
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Feb 11 11:32:23 2020 +0100

    Add xmlPopOutputCallbacks
    
    Add function to pop a single set of output callbacks from the stack.
    This was only implemented for input callbacks before.
    
    Fixes #135.

 doc/symbols.xml        |  3 +++
 include/libxml/xmlIO.h |  2 ++
 libxml2.syms           |  7 +++++++
 xmlIO.c                | 27 +++++++++++++++++++++++++++
 4 files changed, 39 insertions(+)
---
diff --git a/doc/symbols.xml b/doc/symbols.xml
index eeb049d4..a52202a2 100644
--- a/doc/symbols.xml
+++ b/doc/symbols.xml
@@ -1768,4 +1768,7 @@
   <release version="2.9.8">
     <symbol file="hash">xmlHashDefaultDeallocator</symbol>
   </release>
+  <release version="2.9.11">
+    <symbol file="xmlIO">xmlPopOutputCallbacks</symbol>
+  </release>
 </symbols>
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 8690d668..095b2f56 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -217,6 +217,8 @@ xmlParserInputBufferPtr
  */
 XMLPUBFUN void XMLCALL
        xmlCleanupOutputCallbacks               (void);
+XMLPUBFUN int XMLCALL
+       xmlPopOutputCallbacks                   (void);
 XMLPUBFUN void XMLCALL
        xmlRegisterDefaultOutputCallbacks(void);
 XMLPUBFUN xmlOutputBufferPtr XMLCALL
diff --git a/libxml2.syms b/libxml2.syms
index c17d3d98..33bc112c 100644
--- a/libxml2.syms
+++ b/libxml2.syms
@@ -2286,3 +2286,10 @@ LIBXML2_2.9.8 {
   xmlHashDefaultDeallocator;
 } LIBXML2_2.9.1;
 
+LIBXML2_2.9.11 {
+    global:
+
+# xmlIO
+  xmlPopOutputCallbacks;
+} LIBXML2_2.9.8;
+
diff --git a/xmlIO.c b/xmlIO.c
index 752d5e0a..b6384e76 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -560,6 +560,33 @@ xmlCleanupOutputCallbacks(void)
     xmlOutputCallbackNr = 0;
     xmlOutputCallbackInitialized = 0;
 }
+
+/**
+ * xmlPopOutputCallbacks:
+ *
+ * Remove the top output callbacks from the output stack. This includes the
+ * compiled-in I/O.
+ *
+ * Returns the number of output callback registered or -1 in case of error.
+ */
+int
+xmlPopOutputCallbacks(void)
+{
+    if (!xmlOutputCallbackInitialized)
+        return(-1);
+
+    if (xmlOutputCallbackNr <= 0)
+        return(-1);
+
+    xmlOutputCallbackNr--;
+    xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = NULL;
+    xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = NULL;
+    xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = NULL;
+    xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = NULL;
+
+    return(xmlOutputCallbackNr);
+}
+
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 /************************************************************************


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