1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00

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.
This commit is contained in:
Nick Wellnhofer 2020-02-11 11:32:23 +01:00
parent b07251215e
commit c2e09f445c
4 changed files with 39 additions and 0 deletions

View File

@ -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>

View File

@ -217,6 +217,8 @@ xmlParserInputBufferPtr
*/
XMLPUBFUN void XMLCALL
xmlCleanupOutputCallbacks (void);
XMLPUBFUN int XMLCALL
xmlPopOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL

View File

@ -2286,3 +2286,10 @@ LIBXML2_2.9.8 {
xmlHashDefaultDeallocator;
} LIBXML2_2.9.1;
LIBXML2_2.9.11 {
global:
# xmlIO
xmlPopOutputCallbacks;
} LIBXML2_2.9.8;

27
xmlIO.c
View File

@ -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 */
/************************************************************************