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)
xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) {
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL;
}
if (ctxt->attsSpecial != NULL) {
......
......@@ -319,12 +319,13 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret);
/**
* xmlFreeCatalogEntry:
* @ret: a Catalog entry
* @payload: a Catalog entry
*
* Free the memory allocated to a Catalog entry
*/
static void
xmlFreeCatalogEntry(xmlCatalogEntryPtr ret) {
xmlFreeCatalogEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr ret = (xmlCatalogEntryPtr) payload;
if (ret == NULL)
return;
/*
......@@ -367,20 +368,22 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret) {
while (ret != NULL) {
next = ret->next;
xmlFreeCatalogEntry(ret);
xmlFreeCatalogEntry(ret, NULL);
ret = next;
}
}
/**
* xmlFreeCatalogHashEntryList:
* @ret: a Catalog entry list
* @payload: a Catalog entry list
*
* Free the memory allocated to list of Catalog entries from the
* catalog file hash.
*/
static void
xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
xmlFreeCatalogHashEntryList(void *payload,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlCatalogEntryPtr catal = (xmlCatalogEntryPtr) payload;
xmlCatalogEntryPtr children, next;
if (catal == NULL)
......@@ -391,11 +394,11 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
next = children->next;
children->dealloc = 0;
children->children = NULL;
xmlFreeCatalogEntry(children);
xmlFreeCatalogEntry(children, NULL);
children = next;
}
catal->dealloc = 0;
xmlFreeCatalogEntry(catal);
xmlFreeCatalogEntry(catal, NULL);
}
/**
......@@ -440,8 +443,7 @@ xmlFreeCatalog(xmlCatalogPtr catal) {
if (catal->xml != NULL)
xmlFreeCatalogEntryList(catal->xml);
if (catal->sgml != NULL)
xmlHashFree(catal->sgml,
(xmlHashDeallocator) xmlFreeCatalogEntry);
xmlHashFree(catal->sgml, xmlFreeCatalogEntry);
xmlFree(catal);
}
......@@ -460,7 +462,10 @@ xmlFreeCatalog(xmlCatalogPtr catal) {
* Serialize an SGML Catalog entry
*/
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))
return;
switch (entry->type) {
......@@ -723,7 +728,10 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
* Convert one entry from the catalog
*/
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) ||
(catal->xml == NULL))
return;
......@@ -756,8 +764,7 @@ xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) {
entry->type = XML_CATA_CATALOG;
break;
default:
xmlHashRemoveEntry(catal->sgml, entry->name,
(xmlHashDeallocator) xmlFreeCatalogEntry);
xmlHashRemoveEntry(catal->sgml, entry->name, xmlFreeCatalogEntry);
return;
}
/*
......@@ -797,9 +804,7 @@ xmlConvertSGMLCatalog(xmlCatalogPtr catal) {
xmlGenericError(xmlGenericErrorContext,
"Converting SGML catalog to XML\n");
}
xmlHashScan(catal->sgml,
(xmlHashScanner) xmlCatalogConvertEntry,
&catal);
xmlHashScan(catal->sgml, xmlCatalogConvertEntry, &catal);
return(0);
}
......@@ -2486,7 +2491,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
NULL, XML_CATA_PREFER_NONE, NULL);
res = xmlHashAddEntry(catal->sgml, name, entry);
if (res < 0) {
xmlFreeCatalogEntry(entry);
xmlFreeCatalogEntry(entry, NULL);
}
xmlFree(filename);
}
......@@ -2499,7 +2504,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
XML_CATA_PREFER_NONE, NULL);
res = xmlHashAddEntry(catal->sgml, sysid, entry);
if (res < 0) {
xmlFreeCatalogEntry(entry);
xmlFreeCatalogEntry(entry, NULL);
}
} else {
xmlChar *filename;
......@@ -2937,8 +2942,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) {
if (catal->type == XML_XML_CATALOG_TYPE) {
xmlDumpXMLCatalog(out, catal->xml);
} else {
xmlHashScan(catal->sgml,
(xmlHashScanner) xmlCatalogDumpEntry, out);
xmlHashScan(catal->sgml, xmlCatalogDumpEntry, out);
}
}
#endif /* LIBXML_OUTPUT_ENABLED */
......@@ -3002,8 +3006,7 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) {
if (catal->type == XML_XML_CATALOG_TYPE) {
res = xmlDelXMLCatalog(catal->xml, value);
} else {
res = xmlHashRemoveEntry(catal->sgml, value,
(xmlHashDeallocator) xmlFreeCatalogEntry);
res = xmlHashRemoveEntry(catal->sgml, value, xmlFreeCatalogEntry);
if (res == 0)
res = 1;
}
......@@ -3284,8 +3287,7 @@ xmlCatalogCleanup(void) {
xmlGenericError(xmlGenericErrorContext,
"Catalogs cleanup\n");
if (xmlCatalogXMLFiles != NULL)
xmlHashFree(xmlCatalogXMLFiles,
(xmlHashDeallocator)xmlFreeCatalogHashEntryList);
xmlHashFree(xmlCatalogXMLFiles, xmlFreeCatalogHashEntryList);
xmlCatalogXMLFiles = NULL;
if (xmlDefaultCatalog != NULL)
xmlFreeCatalog(xmlDefaultCatalog);
......
......@@ -1229,8 +1229,11 @@ xmlCtxtDumpDocument(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
}
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 (!ctxt->check)
fprintf(ctxt->output, "Entity is NULL");
......@@ -1289,8 +1292,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check)
fprintf(ctxt->output, "Entities in internal subset\n");
xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback,
ctxt);
xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt);
} else
fprintf(ctxt->output, "No entities in internal subset\n");
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
......@@ -1299,8 +1301,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check)
fprintf(ctxt->output, "Entities in external subset\n");
xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback,
ctxt);
xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt);
} else if (!ctxt->check)
fprintf(ctxt->output, "No entities in external subset\n");
}
......
......@@ -1765,4 +1765,7 @@
<symbol file="xpath">xmlXPathNodeEval</symbol>
<symbol file="xpath">xmlXPathSetContextNode</symbol>
</release>
<release version="2.9.8">
<symbol file="hash">xmlHashDefaultDeallocator</symbol>
</release>
</symbols>
......@@ -885,10 +885,9 @@ xmlCreateEntitiesTable(void) {
* Deallocate the memory used by an entities in the hash table.
*/
static void
xmlFreeEntityWrapper(xmlEntityPtr entity,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlFreeEntityWrapper(void *entity, const xmlChar *name ATTRIBUTE_UNUSED) {
if (entity != NULL)
xmlFreeEntity(entity);
xmlFreeEntity((xmlEntityPtr) entity);
}
/**
......@@ -899,7 +898,7 @@ xmlFreeEntityWrapper(xmlEntityPtr entity,
*/
void
xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper);
xmlHashFree(table, xmlFreeEntityWrapper);
}
#ifdef LIBXML_TREE_ENABLED
......@@ -911,8 +910,9 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
*
* Returns the new xmlEntitiesPtr or NULL in case of error.
*/
static xmlEntityPtr
xmlCopyEntity(xmlEntityPtr ent) {
static void *
xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlEntityPtr ent = (xmlEntityPtr) payload;
xmlEntityPtr cur;
cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
......@@ -949,7 +949,7 @@ xmlCopyEntity(xmlEntityPtr ent) {
*/
xmlEntitiesTablePtr
xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity));
return(xmlHashCopy(table, xmlCopyEntity));
}
#endif /* LIBXML_TREE_ENABLED */
......@@ -1090,8 +1090,9 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) {
* When using the hash table scan function, arguments need to be reversed
*/
static void
xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) {
xmlDumpEntityDecl(buf, ent);
xmlDumpEntityDeclScan(void *ent, void *buf,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlDumpEntityDecl((xmlBufferPtr) buf, (xmlEntityPtr) ent);
}
/**
......@@ -1103,7 +1104,7 @@ xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) {
*/
void
xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDeclScan, buf);
xmlHashScan(table, xmlDumpEntityDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
#define bottom_entities
......
......@@ -360,6 +360,18 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
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:
* @table: the hash table
......@@ -912,8 +924,11 @@ void
xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashScanner f, void *data) {
xmlHashScanFull3 (table, name, name2, name3,
(xmlHashScannerFull) f, data);
stubData stubdata;
stubdata.data = data;
stubdata.hashscanner = f;
xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull,
&stubdata);
}
/**
......
......@@ -66,7 +66,7 @@ extern "C" {
*
* Callback to free data from a hash.
*/
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
......@@ -76,7 +76,7 @@ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
*
* 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:
* @payload: the data in the hash
......@@ -85,7 +85,7 @@ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
*
* 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:
* @payload: the data in the hash
......@@ -111,6 +111,9 @@ XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
XMLPUBFUN void XMLCALL
xmlHashDefaultDeallocator(void *entry,
const xmlChar *name);
/*
* Add a new entry to the hash table.
......
......@@ -14876,7 +14876,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) {
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL;
}
if (ctxt->attsSpecial != NULL) {
......
......@@ -1795,7 +1795,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
if (ctxt->attsDefault != NULL)
xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
if (ctxt->attsSpecial != NULL)
xmlHashFree(ctxt->attsSpecial, NULL);
if (ctxt->freeElems != NULL) {
......
......@@ -2729,9 +2729,10 @@ static xmlHashTablePtr xmlRelaxNGRegisteredTypes = NULL;
* Free the structure associated to the type library
*/
static void
xmlRelaxNGFreeTypeLibrary(xmlRelaxNGTypeLibraryPtr lib,
xmlRelaxNGFreeTypeLibrary(void *payload,
const xmlChar * namespace ATTRIBUTE_UNUSED)
{
xmlRelaxNGTypeLibraryPtr lib = (xmlRelaxNGTypeLibraryPtr) payload;
if (lib == NULL)
return;
if (lib->namespace != NULL)
......@@ -2842,8 +2843,7 @@ xmlRelaxNGCleanupTypes(void)
xmlSchemaCleanupTypes();
if (xmlRelaxNGTypeInitialized == 0)
return;
xmlHashFree(xmlRelaxNGRegisteredTypes, (xmlHashDeallocator)
xmlRelaxNGFreeTypeLibrary);
xmlHashFree(xmlRelaxNGRegisteredTypes, xmlRelaxNGFreeTypeLibrary);
xmlRelaxNGTypeInitialized = 0;
}
......@@ -4311,10 +4311,11 @@ xmlRelaxNGCheckGroupAttrs(xmlRelaxNGParserCtxtPtr ctxt,
* algorithm
*/
static void
xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def,
xmlRelaxNGParserCtxtPtr ctxt,
xmlChar * name ATTRIBUTE_UNUSED)
xmlRelaxNGComputeInterleaves(void *payload, void *data,
const xmlChar * name ATTRIBUTE_UNUSED)
{
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGDefinePtr cur, *tmp;
xmlRelaxNGPartitionPtr partitions = NULL;
......@@ -4663,7 +4664,7 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
* Import import one references into the current grammar
*/
static void
xmlRelaxNGParseImportRef(void *payload, void *data, xmlChar *name) {
xmlRelaxNGParseImportRef(void *payload, void *data, const xmlChar *name) {
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
int tmp;
......@@ -5670,10 +5671,10 @@ xmlRelaxNGParseGrammarContent(xmlRelaxNGParserCtxtPtr ctxt,
* element of a given grammar using the same name.
*/
static void
xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
xmlRelaxNGParserCtxtPtr ctxt,
const xmlChar * name)
xmlRelaxNGCheckReference(void *payload, void *data, const xmlChar * name)
{
xmlRelaxNGDefinePtr ref = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGGrammarPtr grammar;
xmlRelaxNGDefinePtr def, cur;
......@@ -5726,9 +5727,10 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
* element of a given grammar using the same name.
*/
static void
xmlRelaxNGCheckCombine(xmlRelaxNGDefinePtr define,
xmlRelaxNGParserCtxtPtr ctxt, const xmlChar * name)
xmlRelaxNGCheckCombine(void *payload, void *data, const xmlChar * name)
{
xmlRelaxNGDefinePtr define = (xmlRelaxNGDefinePtr) payload;
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlChar *combine;
int choiceOrInterleave = -1;
int missing = 0;
......@@ -6611,16 +6613,14 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes)
*/
xmlRelaxNGCombineStart(ctxt, ret);
if (ret->defs != NULL) {
xmlHashScan(ret->defs, (xmlHashScanner) xmlRelaxNGCheckCombine,
ctxt);
xmlHashScan(ret->defs, xmlRelaxNGCheckCombine, ctxt);
}
/*
* link together defines and refs in this grammar
*/
if (ret->refs != NULL) {
xmlHashScan(ret->refs, (xmlHashScanner) xmlRelaxNGCheckReference,
ctxt);
xmlHashScan(ret->refs, xmlRelaxNGCheckReference, ctxt);
}
......@@ -7551,8 +7551,7 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt)
* try to preprocess interleaves
*/
if (ctxt->interleaves != NULL) {
xmlHashScan(ctxt->interleaves,
(xmlHashScanner) xmlRelaxNGComputeInterleaves, ctxt);
xmlHashScan(ctxt->interleaves, xmlRelaxNGComputeInterleaves, ctxt);
}
/*
......
......@@ -1597,6 +1597,11 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt,
return(ret);
}
static void
xmlFreeElementTableEntry(void *elem, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlFreeElement((xmlElementPtr) elem);
}
/**
* xmlFreeElementTable:
* @table: An element table
......@@ -1605,7 +1610,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt,
*/
void
xmlFreeElementTable(xmlElementTablePtr table) {
xmlHashFree(table, (xmlHashDeallocator) xmlFreeElement);
xmlHashFree(table, xmlFreeElementTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
......@@ -1617,8 +1622,9 @@ xmlFreeElementTable(xmlElementTablePtr table) {
*
* Returns the new xmlElementPtr or NULL in case of error.
*/
static xmlElementPtr
xmlCopyElement(xmlElementPtr elem) {
static void *
xmlCopyElement(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlElementPtr elem = (xmlElementPtr) payload;
xmlElementPtr cur;
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
......@@ -1653,8 +1659,7 @@ xmlCopyElement(xmlElementPtr elem) {
*/
xmlElementTablePtr
xmlCopyElementTable(xmlElementTablePtr table) {
return((xmlElementTablePtr) xmlHashCopy(table,
(xmlHashCopier) xmlCopyElement));
return((xmlElementTablePtr) xmlHashCopy(table, xmlCopyElement));
}
#endif /* LIBXML_TREE_ENABLED */
......@@ -1728,8 +1733,9 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
* the arguments.
*/
static void
xmlDumpElementDeclScan(xmlElementPtr elem, xmlBufferPtr buf) {
xmlDumpElementDecl(buf, elem);
xmlDumpElementDeclScan(void *elem, void *buf,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlDumpElementDecl((xmlBufferPtr) buf, (xmlElementPtr) elem);
}
/**
......@@ -1743,7 +1749,7 @@ void
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
xmlHashScan(table, (xmlHashScanner) xmlDumpElementDeclScan, buf);
xmlHashScan(table, xmlDumpElementDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
......@@ -2143,6 +2149,11 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
return(ret);
}
static void
xmlFreeAttributeTableEntry(void *attr, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlFreeAttribute((xmlAttributePtr) attr);
}
/**
* xmlFreeAttributeTable:
* @table: An attribute table
......@@ -2151,7 +2162,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
*/
void
xmlFreeAttributeTable(xmlAttributeTablePtr table) {
xmlHashFree(table, (xmlHashDeallocator) xmlFreeAttribute);
xmlHashFree(table, xmlFreeAttributeTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
......@@ -2163,8 +2174,9 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) {
*
* Returns the new xmlAttributePtr or NULL in case of error.
*/
static xmlAttributePtr
xmlCopyAttribute(xmlAttributePtr attr) {
static void *
xmlCopyAttribute(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlAttributePtr attr = (xmlAttributePtr) payload;
xmlAttributePtr cur;
cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
......@@ -2198,8 +2210,7 @@ xmlCopyAttribute(xmlAttributePtr attr) {
*/
xmlAttributeTablePtr
xmlCopyAttributeTable(xmlAttributeTablePtr table) {
return((xmlAttributeTablePtr) xmlHashCopy(table,
(xmlHashCopier) xmlCopyAttribute));
return((xmlAttributeTablePtr) xmlHashCopy(table, xmlCopyAttribute));
}
#endif /* LIBXML_TREE_ENABLED */
......@@ -2294,8 +2305,9 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
* This is used with the hash scan function - just reverses arguments
*/
static void
xmlDumpAttributeDeclScan(xmlAttributePtr attr, xmlBufferPtr buf) {
xmlDumpAttributeDecl(buf, attr);
xmlDumpAttributeDeclScan(void *attr, void *buf,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlDumpAttributeDecl((xmlBufferPtr) buf, (xmlAttributePtr) attr);
}
/**
......@@ -2309,7 +2321,7 @@ void
xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDeclScan, buf);
xmlHashScan(table, xmlDumpAttributeDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
......@@ -2415,6 +2427,11 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
return(ret);
}
static void
xmlFreeNotationTableEntry(void *nota, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlFreeNotation((xmlNotationPtr) nota);
}
/**
* xmlFreeNotationTable:
* @table: An notation table
......@@ -2423,7 +2440,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
*/
void
xmlFreeNotationTable(xmlNotationTablePtr table) {
xmlHashFree(table, (xmlHashDeallocator) xmlFreeNotation);
xmlHashFree(table, xmlFreeNotationTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
......@@ -2435,8 +2452,9 @@ xmlFreeNotationTable(xmlNotationTablePtr table) {
*
* Returns the new xmlNotationPtr or NULL in case of error.
*/
static xmlNotationPtr
xmlCopyNotation(xmlNotationPtr nota) {
static void *
xmlCopyNotation(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlNotationPtr nota = (xmlNotationPtr) payload;
xmlNotationPtr cur;
cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
......@@ -2469,8 +2487,7 @@ xmlCopyNotation(xmlNotationPtr nota) {
*/
xmlNotationTablePtr
xmlCopyNotationTable(xmlNotationTablePtr table) {
return((xmlNotationTablePtr) xmlHashCopy(table,
(xmlHashCopier) xmlCopyNotation));
return((xmlNotationTablePtr) xmlHashCopy(table, xmlCopyNotation));
}
#endif /* LIBXML_TREE_ENABLED */
......@@ -2510,8 +2527,9 @@ xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) {
* This is called with the hash scan function, and just reverses args
*/
static void
xmlDumpNotationDeclScan(xmlNotationPtr nota, xmlBufferPtr buf) {
xmlDumpNotationDecl(buf, nota);
xmlDumpNotationDeclScan(void *nota, void *buf,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlDumpNotationDecl((xmlBufferPtr) buf, (xmlNotationPtr) nota);
}
/**
......@@ -2525,7 +2543,7 @@ void
xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDeclScan, buf);