textproc/p5-XML-LibXML: fix build with clang 16

Clang 16 has a new error about incompatible function types, which shows
up when building textproc/p5-XML-LibXML:

  perl-libxml-mm.c:142:18: error: incompatible function pointer types passing 'void (void *, void *, xmlChar *)' (aka 'void (void *, void *, unsigned char *)') to parameter of type 'xmlHashScanner' (aka 'void (*)(void *, void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
                  xmlHashScan(r, PmmRegistryDumpHashScanner, NULL);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:213:22: note: passing argument to parameter 'f' here
                                           xmlHashScanner f,
                                                          ^
  perl-libxml-mm.c:234:44: error: incompatible function pointer types passing 'void (void *, xmlChar *)' (aka 'void (void *, unsigned char *)') to parameter of type 'xmlHashDeallocator' (aka 'void (*)(void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
          if( xmlHashRemoveEntry(PmmREGISTRY, name, PmmRegistryHashDeallocator) )
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:160:47: note: passing argument to parameter 'f' here
                             xmlHashDeallocator f);
                                                ^
  perl-libxml-mm.c:301:38: error: incompatible function pointer types passing 'void *(void *, xmlChar *)' (aka 'void *(void *, unsigned char *)') to parameter of type 'xmlHashCopier' (aka 'void *(*)(void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
          reg_copy = xmlHashCopy(PmmREGISTRY, PmmRegistryHashCopier);
                                              ^~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:208:21: note: passing argument to parameter 'f' here
                                           xmlHashCopier f);
                                                         ^

In all three cases, the libxml2 callback functions require const xmlChar
pointers, so fix the parameters in their definitions.

PR:		271355
Approved by:	portmgr (build fix blanket)
MFH:		2023Q2
This commit is contained in:
Dimitry Andric 2023-05-10 21:19:33 +02:00
parent 967c8049e1
commit ea9006c8e8
2 changed files with 30 additions and 0 deletions

View file

@ -1,5 +1,6 @@
PORTNAME= XML-LibXML
PORTVERSION= 2.0208
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= textproc perl5
MASTER_SITES= CPAN

View file

@ -0,0 +1,29 @@
--- perl-libxml-mm.c.orig 2022-09-21 16:57:45 UTC
+++ perl-libxml-mm.c
@@ -121,7 +121,7 @@ extern SV* PROXY_NODE_REGISTRY_MUTEX;
extern SV* PROXY_NODE_REGISTRY_MUTEX;
/* Utility method used by PmmDumpRegistry */
-void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name)
+void PmmRegistryDumpHashScanner(void * payload, void * data, const xmlChar * name)
{
LocalProxyNodePtr lp = (LocalProxyNodePtr) payload;
ProxyNodePtr node = (ProxyNodePtr) lp->proxy;
@@ -215,7 +215,7 @@ static void
/* PP: originally this was static inline void, but on AIX the compiler
did not chew it, so I'm removing the inline */
static void
-PmmRegistryHashDeallocator(void *payload, xmlChar *name)
+PmmRegistryHashDeallocator(void *payload, const xmlChar *name)
{
Safefree((LocalProxyNodePtr) payload);
}
@@ -279,7 +279,7 @@ void *
* internal, used by PmmCloneProxyNodes
*/
void *
-PmmRegistryHashCopier(void *payload, xmlChar *name)
+PmmRegistryHashCopier(void *payload, const xmlChar *name)
{
ProxyNodePtr proxy = ((LocalProxyNodePtr) payload)->proxy;
LocalProxyNodePtr lp;