From aecc0dc1f58f66765d68997bb85b5c4534404c67 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sat, 8 May 2004 02:32:07 +0000 Subject: [PATCH] fixes the use of 'list' as a parameter added xmlPopInputCallback for Matt * valid.c include/libxml/valid.h: fixes the use of 'list' as a parameter * xmlIO.c include/libxml/xmlIO.h: added xmlPopInputCallback for Matt Sergeant Daniel --- ChangeLog | 6 ++++++ NEWS | 2 +- include/libxml/valid.h | 2 +- include/libxml/xmlIO.h | 3 +++ valid.c | 10 +++++----- xmlIO.c | 26 ++++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index baeea4db..9c229592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri May 7 22:31:54 CEST 2004 Daniel Veillard + + * valid.c include/libxml/valid.h: fixes the use of 'list' as a parameter + * xmlIO.c include/libxml/xmlIO.h: added xmlPopInputCallback for + Matt Sergeant + Thu May 6 21:14:38 PDT 2004 William Brack * xmlregexp.c: enhanced the handling of subexpression ranges diff --git a/NEWS b/NEWS index 37c8b35f..e1b46afa 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ There is the list of public releases: dependancy, XML Schemas union support (Kasimier Buchcik), warning removal clanup (William), keep ChangeLog compressed when installing from RPMs - documentation: examples and xmlDocDumpMemory docs (John Fleck), new - example (load, xpath, modify, save), xmlCatalogDump() comments, + example (load, xpath, modify, save), xmlCatalogDump() comments, - Windows: Borland C++ builder (Eric Zurcher), work around Microsoft compiler NaN handling bug (Mark Vakoc) diff --git a/include/libxml/valid.h b/include/libxml/valid.h index 1ff3f0b5..004bb907 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -363,7 +363,7 @@ XMLPUBFUN xmlElementPtr XMLCALL XMLPUBFUN int XMLCALL xmlValidGetValidElements(xmlNode *prev, xmlNode *next, - const xmlChar **list, + const xmlChar **names, int max); XMLPUBFUN int XMLCALL xmlValidGetPotentialChildren(xmlElementContent *ctree, diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index 58a7bb6d..2718d514 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -158,6 +158,9 @@ struct _xmlOutputBuffer { XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks (void); +XMLPUBFUN int XMLCALL + xmlPopInputCallbacks (void); + XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks (void); XMLPUBFUN xmlParserInputBufferPtr XMLCALL diff --git a/valid.c b/valid.c index 378338b9..6460334d 100644 --- a/valid.c +++ b/valid.c @@ -6586,7 +6586,7 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list, * xmlValidGetValidElements: * @prev: an element to insert after * @next: an element to insert next - * @list: an array to store the list of child names + * @names: an array to store the list of child names * @max: the size of the array * * This function returns the list of authorized children to insert @@ -6608,7 +6608,7 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list, */ int -xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list, +xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, int max) { xmlValidCtxt vctxt; int nb_valid_elements = 0; @@ -6632,7 +6632,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list, if (prev == NULL && next == NULL) return(-1); - if (list == NULL) return(-1); + if (names == NULL) return(-1); if (max <= 0) return(-1); nb_valid_elements = 0; @@ -6686,8 +6686,8 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list, int j; for (j = 0; j < nb_valid_elements;j++) - if (xmlStrEqual(elements[i], list[j])) break; - list[nb_valid_elements++] = elements[i]; + if (xmlStrEqual(elements[i], names[j])) break; + names[nb_valid_elements++] = elements[i]; if (nb_valid_elements >= max) break; } } diff --git a/xmlIO.c b/xmlIO.c index 8c4b68fd..970fa6e8 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -475,6 +475,32 @@ xmlCleanupInputCallbacks(void) xmlInputCallbackInitialized = 0; } +/** + * xmlPopInputCallback: + * + * Clear the top input callback from the input stack. this includes the + * compiled-in I/O. + * + * Returns the number of input callback registered or -1 in case of error. + */ +int +xmlPopInputCallbacks(void) +{ + if (!xmlInputCallbackInitialized) + return(-1); + + if (xmlInputCallbackNr <= 0) + return(-1); + + xmlInputCallbackNr--; + xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = NULL; + xmlInputCallbackTable[xmlInputCallbackNr].opencallback = NULL; + xmlInputCallbackTable[xmlInputCallbackNr].readcallback = NULL; + xmlInputCallbackTable[xmlInputCallbackNr].closecallback = NULL; + + return(xmlInputCallbackNr); +} + #ifdef LIBXML_OUTPUT_ENABLED /** * xmlCleanupOutputCallbacks: