[libxslt] Fix hash callback signatures
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Fix hash callback signatures
- Date: Wed, 29 Nov 2017 16:43:41 +0000 (UTC)
commit eb854727399ab0e252a462d26b38612b189ac938
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed Nov 29 15:48:28 2017 +0100
Fix hash callback signatures
libexslt/functions.c | 23 +++++++++-----
libexslt/saxon.c | 8 ++++-
libxslt/attributes.c | 16 +++++++--
libxslt/extensions.c | 80 ++++++++++++++++++++++++++++---------------------
libxslt/imports.c | 3 +-
libxslt/keys.c | 8 ++++-
libxslt/pattern.c | 8 ++++-
libxslt/variables.c | 18 +++++++++--
libxslt/xslt.c | 2 +-
9 files changed, 110 insertions(+), 56 deletions(-)
---
diff --git a/libexslt/functions.c b/libexslt/functions.c
index dc794e3..1711ca1 100644
--- a/libexslt/functions.c
+++ b/libexslt/functions.c
@@ -68,10 +68,12 @@ static exsltFuncFunctionData *exsltFuncNewFunctionData(void);
* Registers a function declared by a func:function element
*/
static void
-exsltFuncRegisterFunc (exsltFuncFunctionData *data,
- xsltTransformContextPtr ctxt,
+exsltFuncRegisterFunc (void *payload, void *vctxt,
const xmlChar *URI, const xmlChar *name,
ATTRIBUTE_UNUSED const xmlChar *ignored) {
+ exsltFuncFunctionData *data = (exsltFuncFunctionData *) payload;
+ xsltTransformContextPtr ctxt = (xsltTransformContextPtr) vctxt;
+
if ((data == NULL) || (ctxt == NULL) || (URI == NULL) || (name == NULL))
return;
@@ -93,10 +95,11 @@ exsltFuncRegisterFunc (exsltFuncFunctionData *data,
* stylesheet. If not, copies function data and registers function
*/
static void
-exsltFuncRegisterImportFunc (exsltFuncFunctionData *data,
- exsltFuncImportRegData *ch,
+exsltFuncRegisterImportFunc (void *payload, void *vctxt,
const xmlChar *URI, const xmlChar *name,
ATTRIBUTE_UNUSED const xmlChar *ignored) {
+ exsltFuncFunctionData *data = (exsltFuncFunctionData *) payload;
+ exsltFuncImportRegData *ch = (exsltFuncImportRegData *) vctxt;
exsltFuncFunctionData *func=NULL;
if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL))
@@ -159,14 +162,13 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI);
ret->funcs = ch.hash;
- xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt);
+ xmlHashScanFull(ch.hash, exsltFuncRegisterFunc, ctxt);
tmp = ctxt->style;
ch.ctxt = ctxt;
while ((tmp=xsltNextImport(tmp))!=NULL) {
hash = xsltGetExtInfo(tmp, URI);
if (hash != NULL) {
- xmlHashScanFull(hash,
- (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch);
+ xmlHashScanFull(hash, exsltFuncRegisterImportFunc, &ch);
}
}
@@ -207,6 +209,11 @@ exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
return xmlHashCreate(1);
}
+static void
+exsltFuncFreeDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFree(payload);
+}
+
/**
* exsltFuncStyleShutdown:
* @style: an XSLT stylesheet
@@ -220,7 +227,7 @@ static void
exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
const xmlChar *URI ATTRIBUTE_UNUSED,
xmlHashTablePtr data) {
- xmlHashFree(data, (xmlHashDeallocator) xmlFree);
+ xmlHashFree(data, exsltFuncFreeDataEntry);
}
/**
diff --git a/libexslt/saxon.c b/libexslt/saxon.c
index 1534396..3b218f9 100644
--- a/libexslt/saxon.c
+++ b/libexslt/saxon.c
@@ -35,6 +35,12 @@ exsltSaxonInit (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
return xmlHashCreate(1);
}
+static void
+exsltSaxonFreeCompExprEntry(void *payload,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlXPathFreeCompExpr((xmlXPathCompExprPtr) payload);
+}
+
/**
* exsltSaxonShutdown:
* @ctxt: an XSLT transformation context
@@ -47,7 +53,7 @@ static void
exsltSaxonShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
const xmlChar *URI ATTRIBUTE_UNUSED,
xmlHashTablePtr data) {
- xmlHashFree(data, (xmlHashDeallocator) xmlXPathFreeCompExpr);
+ xmlHashFree(data, exsltSaxonFreeCompExprEntry);
}
diff --git a/libxslt/attributes.c b/libxslt/attributes.c
index 5958ef3..c43b64d 100644
--- a/libxslt/attributes.c
+++ b/libxslt/attributes.c
@@ -674,9 +674,11 @@ xsltResolveAttrSet(xsltAttrSetPtr set, xsltStylesheetPtr topStyle,
* resolve the references in an attribute set.
*/
static void
-xsltResolveSASCallback(xsltAttrSetPtr set, xsltAttrSetContextPtr asctx,
+xsltResolveSASCallback(void *payload, void *data,
const xmlChar *name, const xmlChar *ns,
ATTRIBUTE_UNUSED const xmlChar *ignored) {
+ xsltAttrSetPtr set = (xsltAttrSetPtr) payload;
+ xsltAttrSetContextPtr asctx = (xsltAttrSetContextPtr) data;
xsltStylesheetPtr topStyle = asctx->topStyle;
xsltStylesheetPtr style = asctx->style;
@@ -723,8 +725,8 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) {
style->attributeSets = xmlHashCreate(10);
}
asctx.style = cur;
- xmlHashScanFull(cur->attributeSets,
- (xmlHashScannerFull) xsltResolveSASCallback, &asctx);
+ xmlHashScanFull(cur->attributeSets, xsltResolveSASCallback,
+ &asctx);
if (cur != style) {
/*
@@ -1225,6 +1227,12 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
}
}
+static void
+xsltFreeAttributeSetsEntry(void *payload,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeAttrSet((xsltAttrSetPtr) payload);
+}
+
/**
* xsltFreeAttributeSetsHashes:
* @style: an XSLT stylesheet
@@ -1235,6 +1243,6 @@ void
xsltFreeAttributeSetsHashes(xsltStylesheetPtr style) {
if (style->attributeSets != NULL)
xmlHashFree((xmlHashTablePtr) style->attributeSets,
- (xmlHashDeallocator) xsltFreeAttrSet);
+ xsltFreeAttributeSetsEntry);
style->attributeSets = NULL;
}
diff --git a/libxslt/extensions.c b/libxslt/extensions.c
index 851d598..b38f018 100644
--- a/libxslt/extensions.c
+++ b/libxslt/extensions.c
@@ -204,6 +204,11 @@ xsltFreeExtModule(xsltExtModulePtr ext)
xmlFree(ext);
}
+static void
+xsltFreeExtModuleEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeExtModule((xsltExtModulePtr) payload);
+}
+
/**
* xsltNewExtData:
* @extModule: the module
@@ -245,6 +250,11 @@ xsltFreeExtData(xsltExtDataPtr ext)
xmlFree(ext);
}
+static void
+xsltFreeExtDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeExtData((xsltExtDataPtr) payload);
+}
+
/**
* xsltNewExtElement:
* @precomp: the pre-computation function
@@ -289,6 +299,11 @@ xsltFreeExtElement(xsltExtElementPtr ext)
xmlFree(ext);
}
+static void
+xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeExtElement((xsltExtElementPtr) payload);
+}
+
#ifdef WITH_MODULES
typedef void (*exsltRegisterFunction) (void);
@@ -936,9 +951,10 @@ struct _xsltInitExtCtxt {
* Initializes an extension module
*/
static void
-xsltInitCtxtExt(xsltExtDataPtr styleData, xsltInitExtCtxt * ctxt,
- const xmlChar * URI)
+xsltInitCtxtExt(void *payload, void *data, const xmlChar * URI)
{
+ xsltExtDataPtr styleData = (xsltExtDataPtr) payload;
+ xsltInitExtCtxt *ctxt = (xsltInitExtCtxt *) data;
xsltExtModulePtr module;
xsltExtDataPtr ctxtData;
void *extData;
@@ -1031,8 +1047,7 @@ xsltInitCtxtExts(xsltTransformContextPtr ctxt)
while (style != NULL) {
if (style->extInfos != NULL) {
- xmlHashScan(style->extInfos,
- (xmlHashScanner) xsltInitCtxtExt, &ctx);
+ xmlHashScan(style->extInfos, xsltInitCtxtExt, &ctx);
if (ctx.ret == -1)
return (-1);
}
@@ -1054,9 +1069,10 @@ xsltInitCtxtExts(xsltTransformContextPtr ctxt)
* Shutdown an extension module loaded
*/
static void
-xsltShutdownCtxtExt(xsltExtDataPtr data, xsltTransformContextPtr ctxt,
- const xmlChar * URI)
+xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar * URI)
{
+ xsltExtDataPtr data = (xsltExtDataPtr) payload;
+ xsltTransformContextPtr ctxt = (xsltTransformContextPtr) vctxt;
xsltExtModulePtr module;
if ((data == NULL) || (ctxt == NULL) || (URI == NULL))
@@ -1085,9 +1101,8 @@ xsltShutdownCtxtExts(xsltTransformContextPtr ctxt)
return;
if (ctxt->extInfos == NULL)
return;
- xmlHashScan(ctxt->extInfos, (xmlHashScanner) xsltShutdownCtxtExt,
- ctxt);
- xmlHashFree(ctxt->extInfos, (xmlHashDeallocator) xsltFreeExtData);
+ xmlHashScan(ctxt->extInfos, xsltShutdownCtxtExt, ctxt);
+ xmlHashFree(ctxt->extInfos, xsltFreeExtDataEntry);
ctxt->extInfos = NULL;
}
@@ -1100,9 +1115,10 @@ xsltShutdownCtxtExts(xsltTransformContextPtr ctxt)
* Shutdown an extension module loaded
*/
static void
-xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style,
- const xmlChar * URI)
+xsltShutdownExt(void *payload, void *vctxt, const xmlChar * URI)
{
+ xsltExtDataPtr data = (xsltExtDataPtr) payload;
+ xsltStylesheetPtr style = (xsltStylesheetPtr) vctxt;
xsltExtModulePtr module;
if ((data == NULL) || (style == NULL) || (URI == NULL))
@@ -1120,8 +1136,7 @@ xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style,
* Don't remove the entry from the hash table here, since
* this will produce segfaults - this fixes bug #340624.
*
- * xmlHashRemoveEntry(style->extInfos, URI,
- * (xmlHashDeallocator) xsltFreeExtData);
+ * xmlHashRemoveEntry(style->extInfos, URI, xsltFreeExtDataEntry);
*/
}
@@ -1138,8 +1153,8 @@ xsltShutdownExts(xsltStylesheetPtr style)
return;
if (style->extInfos == NULL)
return;
- xmlHashScan(style->extInfos, (xmlHashScanner) xsltShutdownExt, style);
- xmlHashFree(style->extInfos, (xmlHashDeallocator) xsltFreeExtData);
+ xmlHashScan(style->extInfos, xsltShutdownExt, style);
+ xmlHashFree(style->extInfos, xsltFreeExtDataEntry);
style->extInfos = NULL;
}
@@ -1327,8 +1342,7 @@ xsltUnregisterExtModule(const xmlChar * URI)
xmlMutexLock(xsltExtMutex);
- ret = xmlHashRemoveEntry(xsltExtensionsHash, URI,
- (xmlHashDeallocator) xsltFreeExtModule);
+ ret = xmlHashRemoveEntry(xsltExtensionsHash, URI, xsltFreeExtModuleEntry);
xmlMutexUnlock(xsltExtMutex);
@@ -1348,8 +1362,7 @@ xsltUnregisterAllExtModules(void)
xmlMutexLock(xsltExtMutex);
- xmlHashFree(xsltExtensionsHash,
- (xmlHashDeallocator) xsltFreeExtModule);
+ xmlHashFree(xsltExtensionsHash, xsltFreeExtModuleEntry);
xsltExtensionsHash = NULL;
xmlMutexUnlock(xsltExtMutex);
@@ -1645,7 +1658,7 @@ xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI,
}
xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext,
- (xmlHashDeallocator) xsltFreeExtElement);
+ xsltFreeExtElementEntry);
done:
xmlMutexUnlock(xsltExtMutex);
@@ -1788,7 +1801,7 @@ xsltUnregisterExtModuleElement(const xmlChar * name, const xmlChar * URI)
xmlMutexLock(xsltExtMutex);
ret = xmlHashRemoveEntry2(xsltElementsHash, name, URI,
- (xmlHashDeallocator) xsltFreeExtElement);
+ xsltFreeExtElementEntry);
xmlMutexUnlock(xsltExtMutex);
@@ -1805,7 +1818,7 @@ xsltUnregisterAllExtModuleElement(void)
{
xmlMutexLock(xsltExtMutex);
- xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement);
+ xmlHashFree(xsltElementsHash, xsltFreeExtElementEntry);
xsltElementsHash = NULL;
xmlMutexUnlock(xsltExtMutex);
@@ -2247,7 +2260,7 @@ xsltRegisterTestModule(void)
static void
xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED,
- xmlChar * name ATTRIBUTE_UNUSED)
+ const xmlChar *name ATTRIBUTE_UNUSED)
{
#ifdef WITH_MODULES
xmlModuleClose(payload);
@@ -2297,10 +2310,11 @@ xsltCleanupGlobals(void)
static void
xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED,
- FILE * output, const xmlChar * name,
+ void *data, const xmlChar * name,
const xmlChar * URI,
const xmlChar * not_used ATTRIBUTE_UNUSED)
{
+ FILE *output = (FILE *) data;
if (!name || !URI)
return;
fprintf(output, "{%s}%s\n", URI, name);
@@ -2308,10 +2322,11 @@ xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED,
static void
xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED,
- FILE * output, const xmlChar * URI,
+ void *data, const xmlChar * URI,
const xmlChar * not_used ATTRIBUTE_UNUSED,
const xmlChar * not_used2 ATTRIBUTE_UNUSED)
{
+ FILE *output = (FILE *) data;
if (!URI)
return;
fprintf(output, "%s\n", URI);
@@ -2335,9 +2350,8 @@ xsltDebugDumpExtensions(FILE * output)
else {
fprintf(output, "Registered Extension Functions:\n");
xmlMutexLock(xsltExtMutex);
- xmlHashScanFull(xsltFunctionsHash,
- (xmlHashScannerFull)
- xsltDebugDumpExtensionsCallback, output);
+ xmlHashScanFull(xsltFunctionsHash, xsltDebugDumpExtensionsCallback,
+ output);
xmlMutexUnlock(xsltExtMutex);
}
if (!xsltElementsHash)
@@ -2345,9 +2359,8 @@ xsltDebugDumpExtensions(FILE * output)
else {
fprintf(output, "\nRegistered Extension Elements:\n");
xmlMutexLock(xsltExtMutex);
- xmlHashScanFull(xsltElementsHash,
- (xmlHashScannerFull)
- xsltDebugDumpExtensionsCallback, output);
+ xmlHashScanFull(xsltElementsHash, xsltDebugDumpExtensionsCallback,
+ output);
xmlMutexUnlock(xsltExtMutex);
}
if (!xsltExtensionsHash)
@@ -2355,9 +2368,8 @@ xsltDebugDumpExtensions(FILE * output)
else {
fprintf(output, "\nRegistered Extension Modules:\n");
xmlMutexLock(xsltExtMutex);
- xmlHashScanFull(xsltExtensionsHash,
- (xmlHashScannerFull)
- xsltDebugDumpExtModulesCallback, output);
+ xmlHashScanFull(xsltExtensionsHash, xsltDebugDumpExtModulesCallback,
+ output);
xmlMutexUnlock(xsltExtMutex);
}
diff --git a/libxslt/imports.c b/libxslt/imports.c
index 6fca029..874870c 100644
--- a/libxslt/imports.c
+++ b/libxslt/imports.c
@@ -65,8 +65,7 @@
static void xsltFixImportedCompSteps(xsltStylesheetPtr master,
xsltStylesheetPtr style) {
xsltStylesheetPtr res;
- xmlHashScan(style->templatesHash,
- (xmlHashScanner) xsltNormalizeCompSteps, master);
+ xmlHashScan(style->templatesHash, xsltNormalizeCompSteps, master);
master->extrasNr += style->extrasNr;
for (res = style->imports; res != NULL; res = res->next) {
xsltFixImportedCompSteps(master, res);
diff --git a/libxslt/keys.c b/libxslt/keys.c
index 85902b0..2881056 100644
--- a/libxslt/keys.c
+++ b/libxslt/keys.c
@@ -144,6 +144,11 @@ xsltNewKeyTable(const xmlChar *name, const xmlChar *nameURI) {
return(cur);
}
+static void
+xsltFreeNodeSetEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlXPathFreeNodeSet((xmlNodeSetPtr) payload);
+}
+
/**
* xsltFreeKeyTable:
* @keyt: an XSLT key table
@@ -159,8 +164,7 @@ xsltFreeKeyTable(xsltKeyTablePtr keyt) {
if (keyt->nameURI != NULL)
xmlFree(keyt->nameURI);
if (keyt->keys != NULL)
- xmlHashFree(keyt->keys,
- (xmlHashDeallocator) xmlXPathFreeNodeSet);
+ xmlHashFree(keyt->keys, xsltFreeNodeSetEntry);
memset(keyt, -1, sizeof(xsltKeyTable));
xmlFree(keyt);
}
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index c094e97..9a97070 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -218,6 +218,12 @@ xsltFreeCompMatchList(xsltCompMatchPtr comp) {
}
}
+static void
+xsltFreeCompMatchListEntry(void *payload,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeCompMatchList((xsltCompMatchPtr) payload);
+}
+
/**
* xsltNormalizeCompSteps:
* @payload: pointer to template hash table entry
@@ -2578,7 +2584,7 @@ void
xsltFreeTemplateHashes(xsltStylesheetPtr style) {
if (style->templatesHash != NULL)
xmlHashFree((xmlHashTablePtr) style->templatesHash,
- (xmlHashDeallocator) xsltFreeCompMatchList);
+ xsltFreeCompMatchListEntry);
if (style->rootMatch != NULL)
xsltFreeCompMatchList(style->rootMatch);
if (style->keyMatch != NULL)
diff --git a/libxslt/variables.c b/libxslt/variables.c
index 60b46ea..fe6f299 100644
--- a/libxslt/variables.c
+++ b/libxslt/variables.c
@@ -616,6 +616,12 @@ xsltFreeStackElem(xsltStackElemPtr elem) {
xmlFree(elem);
}
+static void
+xsltFreeStackElemEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltFreeStackElem((xsltStackElemPtr) payload);
+}
+
+
/**
* xsltFreeStackElemList:
* @elem: an XSLT stack element
@@ -1255,6 +1261,13 @@ error:
return(result);
}
+static void
+xsltEvalGlobalVariableWrapper(void *payload, void *data,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xsltEvalGlobalVariable((xsltStackElemPtr) payload,
+ (xsltTransformContextPtr) data);
+}
+
/**
* xsltEvalGlobalVariables:
* @ctxt: the XSLT transformation context
@@ -1329,8 +1342,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
/*
* This part does the actual evaluation
*/
- xmlHashScan(ctxt->globalVars,
- (xmlHashScanner) xsltEvalGlobalVariable, ctxt);
+ xmlHashScan(ctxt->globalVars, xsltEvalGlobalVariableWrapper, ctxt);
return(0);
}
@@ -2234,7 +2246,7 @@ xsltParseStylesheetParam(xsltTransformContextPtr ctxt, xmlNodePtr cur)
void
xsltFreeGlobalVariables(xsltTransformContextPtr ctxt) {
- xmlHashFree(ctxt->globalVars, (xmlHashDeallocator) xsltFreeStackElem);
+ xmlHashFree(ctxt->globalVars, xsltFreeStackElemEntry);
}
/**
diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index 54a39de..780a5ad 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -3725,7 +3725,7 @@ xsltGatherNamespaces(xsltStylesheetPtr style) {
style->warnings++;
} else if (URI == NULL) {
xmlHashUpdateEntry(style->nsHash, ns->prefix,
- (void *) ns->href, (xmlHashDeallocator)xmlFree);
+ (void *) ns->href, NULL);
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]