Commit e03f0a19 authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

Fix hash callback signatures

Make sure that all parameters and return values of hash callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Fixes bug 784861.
parent 71462a60
...@@ -6674,7 +6674,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) ...@@ -6674,7 +6674,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
xmlInitNodeInfoSeq(&ctxt->node_seq); xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) { if (ctxt->attsDefault != NULL) {
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL; ctxt->attsDefault = NULL;
} }
if (ctxt->attsSpecial != NULL) { if (ctxt->attsSpecial != NULL) {
......
...@@ -319,12 +319,13 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret); ...@@ -319,12 +319,13 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret);
/** /**
* xmlFreeCatalogEntry: * xmlFreeCatalogEntry:
* @ret: a Catalog entry * @payload: a Catalog entry
* *
* Free the memory allocated to a Catalog entry * Free the memory allocated to a Catalog entry
*/ */
static void static void
xmlFreeCatalogEntry(xmlCatalogEntryPtr ret) { xmlFreeCatalogEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr ret = (xmlCatalogEntryPtr) payload;
if (ret == NULL) if (ret == NULL)
return; return;
/* /*
...@@ -367,20 +368,22 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret) { ...@@ -367,20 +368,22 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret) {
while (ret != NULL) { while (ret != NULL) {
next = ret->next; next = ret->next;
xmlFreeCatalogEntry(ret); xmlFreeCatalogEntry(ret, NULL);
ret = next; ret = next;
} }
} }
/** /**
* xmlFreeCatalogHashEntryList: * xmlFreeCatalogHashEntryList:
* @ret: a Catalog entry list * @payload: a Catalog entry list
* *
* Free the memory allocated to list of Catalog entries from the * Free the memory allocated to list of Catalog entries from the
* catalog file hash. * catalog file hash.
*/ */
static void static void
xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) { xmlFreeCatalogHashEntryList(void *payload,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr catal = (xmlCatalogEntryPtr) payload;
xmlCatalogEntryPtr children, next; xmlCatalogEntryPtr children, next;
if (catal == NULL) if (catal == NULL)
...@@ -391,11 +394,11 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) { ...@@ -391,11 +394,11 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
next = children->next; next = children->next;
children->dealloc = 0; children->dealloc = 0;
children->children = NULL; children->children = NULL;
xmlFreeCatalogEntry(children); xmlFreeCatalogEntry(children, NULL);
children = next; children = next;
} }
catal->dealloc = 0; catal->dealloc = 0;
xmlFreeCatalogEntry(catal); xmlFreeCatalogEntry(catal, NULL);
} }
/** /**
...@@ -440,8 +443,7 @@ xmlFreeCatalog(xmlCatalogPtr catal) { ...@@ -440,8 +443,7 @@ xmlFreeCatalog(xmlCatalogPtr catal) {
if (catal->xml != NULL) if (catal->xml != NULL)
xmlFreeCatalogEntryList(catal->xml); xmlFreeCatalogEntryList(catal->xml);
if (catal->sgml != NULL) if (catal->sgml != NULL)
xmlHashFree(catal->sgml, xmlHashFree(catal->sgml, xmlFreeCatalogEntry);
(xmlHashDeallocator) xmlFreeCatalogEntry);
xmlFree(catal); xmlFree(catal);
} }
...@@ -460,7 +462,10 @@ xmlFreeCatalog(xmlCatalogPtr catal) { ...@@ -460,7 +462,10 @@ xmlFreeCatalog(xmlCatalogPtr catal) {
* Serialize an SGML Catalog entry * Serialize an SGML Catalog entry
*/ */
static void static void
xmlCatalogDumpEntry(xmlCatalogEntryPtr entry, FILE *out) { xmlCatalogDumpEntry(void *payload, void *data,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr entry = (xmlCatalogEntryPtr) payload;
FILE *out = (FILE *) data;
if ((entry == NULL) || (out == NULL)) if ((entry == NULL) || (out == NULL))
return; return;
switch (entry->type) { switch (entry->type) {
...@@ -723,7 +728,10 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"); ...@@ -723,7 +728,10 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
* Convert one entry from the catalog * Convert one entry from the catalog
*/ */
static void static void
xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) { xmlCatalogConvertEntry(void *payload, void *data,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr entry = (xmlCatalogEntryPtr) payload;
xmlCatalogPtr catal = (xmlCatalogPtr) data;
if ((entry == NULL) || (catal == NULL) || (catal->sgml == NULL) || if ((entry == NULL) || (catal == NULL) || (catal->sgml == NULL) ||
(catal->xml == NULL)) (catal->xml == NULL))
return; return;
...@@ -756,8 +764,7 @@ xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) { ...@@ -756,8 +764,7 @@ xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) {
entry->type = XML_CATA_CATALOG; entry->type = XML_CATA_CATALOG;
break; break;
default: default:
xmlHashRemoveEntry(catal->sgml, entry->name, xmlHashRemoveEntry(catal->sgml, entry->name, xmlFreeCatalogEntry);
(xmlHashDeallocator) xmlFreeCatalogEntry);
return; return;
} }
/* /*
...@@ -797,9 +804,7 @@ xmlConvertSGMLCatalog(xmlCatalogPtr catal) { ...@@ -797,9 +804,7 @@ xmlConvertSGMLCatalog(xmlCatalogPtr catal) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Converting SGML catalog to XML\n"); "Converting SGML catalog to XML\n");
} }
xmlHashScan(catal->sgml, xmlHashScan(catal->sgml, xmlCatalogConvertEntry, &catal);
(xmlHashScanner) xmlCatalogConvertEntry,
&catal);
return(0); return(0);
} }
...@@ -2486,7 +2491,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, ...@@ -2486,7 +2491,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
NULL, XML_CATA_PREFER_NONE, NULL); NULL, XML_CATA_PREFER_NONE, NULL);
res = xmlHashAddEntry(catal->sgml, name, entry); res = xmlHashAddEntry(catal->sgml, name, entry);
if (res < 0) { if (res < 0) {
xmlFreeCatalogEntry(entry); xmlFreeCatalogEntry(entry, NULL);
} }
xmlFree(filename); xmlFree(filename);
} }
...@@ -2499,7 +2504,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, ...@@ -2499,7 +2504,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
XML_CATA_PREFER_NONE, NULL); XML_CATA_PREFER_NONE, NULL);
res = xmlHashAddEntry(catal->sgml, sysid, entry); res = xmlHashAddEntry(catal->sgml, sysid, entry);
if (res < 0) { if (res < 0) {
xmlFreeCatalogEntry(entry); xmlFreeCatalogEntry(entry, NULL);
} }
} else { } else {
xmlChar *filename; xmlChar *filename;
...@@ -2937,8 +2942,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) { ...@@ -2937,8 +2942,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) {
if (catal->type == XML_XML_CATALOG_TYPE) { if (catal->type == XML_XML_CATALOG_TYPE) {
xmlDumpXMLCatalog(out, catal->xml); xmlDumpXMLCatalog(out, catal->xml);
} else { } else {
xmlHashScan(catal->sgml, xmlHashScan(catal->sgml, xmlCatalogDumpEntry, out);
(xmlHashScanner) xmlCatalogDumpEntry, out);
} }
} }
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
...@@ -3002,8 +3006,7 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) { ...@@ -3002,8 +3006,7 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) {
if (catal->type == XML_XML_CATALOG_TYPE) { if (catal->type == XML_XML_CATALOG_TYPE) {
res = xmlDelXMLCatalog(catal->xml, value); res = xmlDelXMLCatalog(catal->xml, value);
} else { } else {
res = xmlHashRemoveEntry(catal->sgml, value, res = xmlHashRemoveEntry(catal->sgml, value, xmlFreeCatalogEntry);
(xmlHashDeallocator) xmlFreeCatalogEntry);
if (res == 0) if (res == 0)
res = 1; res = 1;
} }
...@@ -3284,8 +3287,7 @@ xmlCatalogCleanup(void) { ...@@ -3284,8 +3287,7 @@ xmlCatalogCleanup(void) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Catalogs cleanup\n"); "Catalogs cleanup\n");
if (xmlCatalogXMLFiles != NULL) if (xmlCatalogXMLFiles != NULL)
xmlHashFree(xmlCatalogXMLFiles, xmlHashFree(xmlCatalogXMLFiles, xmlFreeCatalogHashEntryList);
(xmlHashDeallocator)xmlFreeCatalogHashEntryList);
xmlCatalogXMLFiles = NULL; xmlCatalogXMLFiles = NULL;
if (xmlDefaultCatalog != NULL) if (xmlDefaultCatalog != NULL)
xmlFreeCatalog(xmlDefaultCatalog); xmlFreeCatalog(xmlDefaultCatalog);
......
...@@ -1229,8 +1229,11 @@ xmlCtxtDumpDocument(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) ...@@ -1229,8 +1229,11 @@ xmlCtxtDumpDocument(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
} }
static void static void
xmlCtxtDumpEntityCallback(xmlEntityPtr cur, xmlDebugCtxtPtr ctxt) xmlCtxtDumpEntityCallback(void *payload, void *data,
const xmlChar *name ATTRIBUTE_UNUSED)
{ {
xmlEntityPtr cur = (xmlEntityPtr) payload;
xmlDebugCtxtPtr ctxt = (xmlDebugCtxtPtr) data;
if (cur == NULL) { if (cur == NULL) {
if (!ctxt->check) if (!ctxt->check)
fprintf(ctxt->output, "Entity is NULL"); fprintf(ctxt->output, "Entity is NULL");
...@@ -1289,8 +1292,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) ...@@ -1289,8 +1292,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check) if (!ctxt->check)
fprintf(ctxt->output, "Entities in internal subset\n"); fprintf(ctxt->output, "Entities in internal subset\n");
xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback, xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt);
ctxt);
} else } else
fprintf(ctxt->output, "No entities in internal subset\n"); fprintf(ctxt->output, "No entities in internal subset\n");
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
...@@ -1299,8 +1301,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) ...@@ -1299,8 +1301,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check) if (!ctxt->check)
fprintf(ctxt->output, "Entities in external subset\n"); fprintf(ctxt->output, "Entities in external subset\n");
xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback, xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt);
ctxt);
} else if (!ctxt->check) } else if (!ctxt->check)
fprintf(ctxt->output, "No entities in external subset\n"); fprintf(ctxt->output, "No entities in external subset\n");
} }
......
...@@ -1765,4 +1765,7 @@ ...@@ -1765,4 +1765,7 @@
<symbol file="xpath">xmlXPathNodeEval</symbol> <symbol file="xpath">xmlXPathNodeEval</symbol>
<symbol file="xpath">xmlXPathSetContextNode</symbol> <symbol file="xpath">xmlXPathSetContextNode</symbol>
</release> </release>
<release version="2.9.8">
<symbol file="hash">xmlHashDefaultDeallocator</symbol>
</release>
</symbols> </symbols>
...@@ -885,10 +885,9 @@ xmlCreateEntitiesTable(void) { ...@@ -885,10 +885,9 @@ xmlCreateEntitiesTable(void) {
* Deallocate the memory used by an entities in the hash table. * Deallocate the memory used by an entities in the hash table.
*/ */
static void static void
xmlFreeEntityWrapper(xmlEntityPtr entity, xmlFreeEntityWrapper(void *entity, const xmlChar *name ATTRIBUTE_UNUSED) {
const xmlChar *name ATTRIBUTE_UNUSED) {
if (entity != NULL) if (entity != NULL)
xmlFreeEntity(entity); xmlFreeEntity((xmlEntityPtr) entity);
} }
/** /**
...@@ -899,7 +898,7 @@ xmlFreeEntityWrapper(xmlEntityPtr entity, ...@@ -899,7 +898,7 @@ xmlFreeEntityWrapper(xmlEntityPtr entity,
*/ */
void void
xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper); xmlHashFree(table, xmlFreeEntityWrapper);
} }
#ifdef LIBXML_TREE_ENABLED #ifdef LIBXML_TREE_ENABLED
...@@ -911,8 +910,9 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { ...@@ -911,8 +910,9 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
* *
* Returns the new xmlEntitiesPtr or NULL in case of error. * Returns the new xmlEntitiesPtr or NULL in case of error.
*/ */
static xmlEntityPtr static void *
xmlCopyEntity(xmlEntityPtr ent) { xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlEntityPtr ent = (xmlEntityPtr) payload;
xmlEntityPtr cur; xmlEntityPtr cur;
cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
...@@ -949,7 +949,7 @@ xmlCopyEntity(xmlEntityPtr ent) { ...@@ -949,7 +949,7 @@ xmlCopyEntity(xmlEntityPtr ent) {
*/ */
xmlEntitiesTablePtr xmlEntitiesTablePtr
xmlCopyEntitiesTable(xmlEntitiesTablePtr table) { xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity)); return(xmlHashCopy(table, xmlCopyEntity));
} }
#endif /* LIBXML_TREE_ENABLED */ #endif /* LIBXML_TREE_ENABLED */
...@@ -1090,8 +1090,9 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) { ...@@ -1090,8 +1090,9 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) {
* When using the hash table scan function, arguments need to be reversed * When using the hash table scan function, arguments need to be reversed
*/ */
static void static void
xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { xmlDumpEntityDeclScan(void *ent, void *buf,
xmlDumpEntityDecl(buf, ent); const xmlChar *name ATTRIBUTE_UNUSED) {
xmlDumpEntityDecl((xmlBufferPtr) buf, (xmlEntityPtr) ent);
} }
/** /**
...@@ -1103,7 +1104,7 @@ xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { ...@@ -1103,7 +1104,7 @@ xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) {
*/ */
void void
xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) { xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDeclScan, buf); xmlHashScan(table, xmlDumpEntityDeclScan, buf);
} }
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
#define bottom_entities #define bottom_entities
......
...@@ -360,6 +360,18 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { ...@@ -360,6 +360,18 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
xmlFree(table); xmlFree(table);
} }
/**
* xmlHashDefaultDeallocator:
* @entry: the hash table entry
* @name: the entry's name
*
* Free a hash table entry with xmlFree.
*/
void
xmlHashDefaultDeallocator(void *entry, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlFree(entry);
}
/** /**
* xmlHashAddEntry: * xmlHashAddEntry:
* @table: the hash table * @table: the hash table
...@@ -912,8 +924,11 @@ void ...@@ -912,8 +924,11 @@ void
xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3, const xmlChar *name2, const xmlChar *name3,
xmlHashScanner f, void *data) { xmlHashScanner f, void *data) {
xmlHashScanFull3 (table, name, name2, name3, stubData stubdata;
(xmlHashScannerFull) f, data); stubdata.data = data;
stubdata.hashscanner = f;
xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull,
&stubdata);
} }
/** /**
......
...@@ -66,7 +66,7 @@ extern "C" { ...@@ -66,7 +66,7 @@ extern "C" {
* *
* Callback to free data from a hash. * Callback to free data from a hash.
*/ */
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
/** /**
* xmlHashCopier: * xmlHashCopier:
* @payload: the data in the hash * @payload: the data in the hash
...@@ -76,7 +76,7 @@ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); ...@@ -76,7 +76,7 @@ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
* *
* Returns a copy of the data or NULL in case of error. * Returns a copy of the data or NULL in case of error.
*/ */
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
/** /**
* xmlHashScanner: * xmlHashScanner:
* @payload: the data in the hash * @payload: the data in the hash
...@@ -85,7 +85,7 @@ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); ...@@ -85,7 +85,7 @@ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
* *
* Callback when scanning data in a hash with the simple scanner. * Callback when scanning data in a hash with the simple scanner.
*/ */
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
/** /**
* xmlHashScannerFull: * xmlHashScannerFull:
* @payload: the data in the hash * @payload: the data in the hash
...@@ -111,6 +111,9 @@ XMLPUBFUN xmlHashTablePtr XMLCALL ...@@ -111,6 +111,9 @@ XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table, xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f); xmlHashDeallocator f);
XMLPUBFUN void XMLCALL
xmlHashDefaultDeallocator(void *entry,
const xmlChar *name);
/* /*
* Add a new entry to the hash table. * Add a new entry to the hash table.
......
...@@ -14876,7 +14876,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt) ...@@ -14876,7 +14876,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
xmlInitNodeInfoSeq(&ctxt->node_seq); xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) { if (ctxt->attsDefault != NULL) {
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL; ctxt->attsDefault = NULL;
} }
if (ctxt->attsSpecial != NULL) { if (ctxt->attsSpecial != NULL) {
......
...@@ -1795,7 +1795,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt) ...@@ -1795,7 +1795,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab); if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs); if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
if (ctxt->attsDefault != NULL) if (ctxt->attsDefault != NULL)
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
if (ctxt->attsSpecial != NULL) if (ctxt->attsSpecial != NULL)
xmlHashFree(ctxt->attsSpecial, NULL); xmlHashFree(ctxt->attsSpecial, NULL);
if (ctxt->freeElems != NULL) { if (ctxt->freeElems != NULL) {
......
...@@ -2729,9 +2729,10 @@ static xmlHashTablePtr xmlRelaxNGRegisteredTypes = NULL; ...@@ -2729,9 +2729,10 @@ static xmlHashTablePtr xmlRelaxNGRegisteredTypes = NULL;
* Free the structure associated to the type library * Free the structure associated to the type library
*/ */
static void static void
xmlRelaxNGFreeTypeLibrary(xmlRelaxNGTypeLibraryPtr lib, xmlRelaxNGFreeTypeLibrary(void *payload,
const xmlChar * namespace ATTRIBUTE_UNUSED) const xmlChar * namespace ATTRIBUTE_UNUSED)
{ {
xmlRelaxNGTypeLibraryPtr lib = (xmlRelaxNGTypeLibraryPtr) payload;
if (lib == NULL) if (lib == NULL)
return; return;
if (lib->namespace != NULL) if (lib->namespace != NULL)
...@@ -2842,8 +2843,7 @@ xmlRelaxNGCleanupTypes(void) ...@@ -2842,8 +2843,7 @@ xmlRelaxNGCleanupTypes(void)
xmlSchemaCleanupTypes(); xmlSchemaCleanupTypes();
if (xmlRelaxNGTypeInitialized == 0) if (xmlRelaxNGTypeInitialized == 0)
return; return;
xmlHashFree(xmlRelaxNGRegisteredTypes, (xmlHashDeallocator) xmlHashFree(xmlRelaxNGRegisteredTypes, xmlRelaxNGFreeTypeLibrary);
xmlRelaxNGFreeTypeLibrary);
xmlRelaxNGTypeInitialized = 0; xmlRelaxNGTypeInitialized = 0;
} }
...@@ -4311,10 +4311,11 @@ xmlRelaxNGCheckGroupAttrs(xmlRelaxNGParserCtxtPtr ctxt, ...@@ -4311,10 +4311,11 @@ xmlRelaxNGCheckGroupAttrs(xmlRelaxNGParserCtxtPtr ctxt,
* algorithm * algorithm
*/ */
static void static void
xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, xmlRelaxNGComputeInterleaves(void *payload, void *data,
xmlRelaxNGParserCtxtPtr ctxt, const xmlChar * name ATTRIBUTE_UNUSED)
xmlChar * name ATTRIBUTE_UNUSED)
{ {
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGDefinePtr cur, *tmp; xmlRelaxNGDefinePtr cur, *tmp;
xmlRelaxNGPartitionPtr partitions = NULL; xmlRelaxNGPartitionPtr partitions = NULL;
...@@ -4663,7 +4664,7 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) ...@@ -4663,7 +4664,7 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
* Import import one references into the current grammar * Import import one references into the current grammar
*/ */
static void static void
xmlRelaxNGParseImportRef(void *payload, void *data, xmlChar *name) { xmlRelaxNGParseImportRef(void *payload, void *data, const xmlChar *name) {
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data; xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload; xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
int tmp; int tmp;
...@@ -5670,10 +5671,10 @@ xmlRelaxNGParseGrammarContent(xmlRelaxNGParserCtxtPtr ctxt, ...@@ -5670,10 +5671,10 @@ xmlRelaxNGParseGrammarContent(xmlRelaxNGParserCtxtPtr ctxt,
* element of a given grammar using the same name. * element of a given grammar using the same name.
*/ */
static void static void
xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref, xmlRelaxNGCheckReference(void *payload, void *data, const xmlChar * name)
xmlRelaxNGParserCtxtPtr ctxt,
const xmlChar * name)
{ {
xmlRelaxNGDefinePtr ref = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGGrammarPtr grammar; xmlRelaxNGGrammarPtr grammar;
xmlRelaxNGDefinePtr def, cur; xmlRelaxNGDefinePtr def, cur;
...@@ -5726,9 +5727,10 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref, ...@@ -5726,9 +5727,10 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
* element of a given grammar using the same name. * element of a given grammar using the same name.
*/ */
static void static void
xmlRelaxNGCheckCombine(xmlRelaxNGDefinePtr define, xmlRelaxNGCheckCombine(void *payload, void *data, const xmlChar * name)
xmlRelaxNGParserCtxtPtr ctxt, const xmlChar * name)
{ {
xmlRelaxNGDefinePtr define = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlChar *combine;