mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
new dictionary module to keep a single instance of the names used by the
* dict.c include/libxml/dict.h Makefile.am include/libxml/Makefile.am: new dictionary module to keep a single instance of the names used by the parser * DOCBparser.c HTMLparser.c parser.c parserInternals.c valid.c: switched all parsers to use the dictionary internally * include/libxml/HTMLparser.h include/libxml/parser.h include/libxml/parserInternals.h include/libxml/valid.h: Some of the interfaces changed as a result to receive or return "const xmlChar *" instead of "xmlChar *", this is either insignificant from an user point of view or when the returning value changed, those function are really parser internal methods that no user code should really change * doc/libxml2-api.xml doc/html/*: the API interface changed and the docs were regenerated Daniel
This commit is contained in:
@ -47,6 +47,7 @@
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/SAX.h>
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#include <libxml/catalog.h>
|
||||
@ -2202,6 +2203,12 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
||||
|
||||
xmlDefaultSAXHandlerInit();
|
||||
|
||||
ctxt->dict = xmlDictCreate();
|
||||
if (ctxt->dict == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlInitParserCtxt: out of memory\n");
|
||||
return(-1);
|
||||
}
|
||||
ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
|
||||
if (ctxt->sax == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
@ -2255,7 +2262,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
||||
ctxt->node = NULL;
|
||||
|
||||
/* Allocate the Name stack */
|
||||
ctxt->nameTab = (xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
|
||||
ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
|
||||
if (ctxt->nameTab == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlInitParserCtxt: out of memory\n");
|
||||
@ -2344,29 +2351,25 @@ void
|
||||
xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
xmlParserInputPtr input;
|
||||
xmlChar *oldname;
|
||||
|
||||
if (ctxt == NULL) return;
|
||||
|
||||
while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
|
||||
xmlFreeInputStream(input);
|
||||
}
|
||||
while ((oldname = namePop(ctxt)) != NULL) { /* Non consuming */
|
||||
xmlFree(oldname);
|
||||
}
|
||||
if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab);
|
||||
if (ctxt->nameTab != NULL) xmlFree(ctxt->nameTab);
|
||||
if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
|
||||
if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
|
||||
if (ctxt->version != NULL) xmlFree((char *) ctxt->version);
|
||||
if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding);
|
||||
if (ctxt->intSubName != NULL) xmlFree((char *) ctxt->intSubName);
|
||||
if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI);
|
||||
if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem);
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax != &xmlDefaultSAXHandler))
|
||||
xmlFree(ctxt->sax);
|
||||
if (ctxt->directory != NULL) xmlFree((char *) ctxt->directory);
|
||||
if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab);
|
||||
if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
if (ctxt->catalogs != NULL)
|
||||
xmlCatalogFreeLocal(ctxt->catalogs);
|
||||
|
Reference in New Issue
Block a user