testing/perl-xml-bare: apply debian patches

to include `stdlib.h` and fix
pointer from integer without cast
This commit is contained in:
Celeste 2024-05-25 15:26:41 +00:00
parent 1cf83854eb
commit 737533635e
3 changed files with 90 additions and 1 deletions

View File

@ -12,7 +12,10 @@ license="GPL-2.0-or-later OR Artistic-1.0-Perl"
depends="perl"
makedepends="perl-dev"
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/C/CO/CODECHILD/XML-Bare-$pkgver.tar.gz"
source="https://cpan.metacpan.org/authors/id/C/CO/CODECHILD/XML-Bare-$pkgver.tar.gz
implicit_declaration_of_free.patch
pointer_from_integer.patch
"
builddir="$srcdir/$_pkgreal-$pkgver"
build() {
@ -35,4 +38,6 @@ package() {
sha512sums="
e765206e5c98ed3a0c29be3a323e25beaa712489d0461e2e7269f5f3383fa805ba3829a9ed4d31cd86f35400c321f8cf519162cc41f52f8ba6992c7016f63520 XML-Bare-0.53.tar.gz
7804264042f40fcbb95f485c9b6f73a2be49ed1935a94603ca50b04e76ad4ad5b16b0a500ef0de2d1ceb4a5686080ad5c1bae10275757c2e7e84bac102f4a94d implicit_declaration_of_free.patch
7de75f3d7622507dc30c5d9b8af7bae67ba4f87bb44c0ff1ac02d206508e1a8bf84e81e10b3beef42d4ddfb4d3c5ba84d2638709160770cd186bea900cd3d64f pointer_from_integer.patch
"

View File

@ -0,0 +1,18 @@
Patch-Source: https://sources.debian.org/data/main/libx/libxml-bare-perl/0.53-4/debian/patches/implicit_declaration_of_free.patch
--
Description: fix warning "incompatible implicit declaration of built-in function 'free'"
by unconditionally including stdlib.h (required on Linux)
Author: Florian Schlichting <fsfs@debian.org>
--- a/parser.c
+++ b/parser.c
@@ -1,8 +1,6 @@
#include "parser.h"
#include<stdio.h>
-#ifdef DARWIN
- #include "stdlib.h"
-#endif
+#include "stdlib.h"
#ifdef NOSTRING
void memset(char *s, int c, int n) {
char *se = s + n;

View File

@ -0,0 +1,66 @@
Patch-Source: https://sources.debian.org/data/main/libx/libxml-bare-perl/0.53-4/debian/patches/pointer_from_integer.patch
--
Description: fix use of pointer as int
fixes "warning: comparison between pointer and integer" and
"warning: assignment makes pointer from integer without a cast"
compiler warnings
Author: Florian Schlichting <fsfs@debian.org>
--- a/Bare.xs
+++ b/Bare.xs
@@ -144,7 +144,7 @@
SV *atthref = newRV_noinc( (SV *) atth );
hv_store( output, curatt->name, curatt->namelen, atthref, 0 );
- if( curatt->value == -1 ) attval = newSVpvn( "1", 1 );
+ if( curatt->value == NULL ) attval = newSVpvn( "1", 1 );
else attval = newSVpvn( curatt->value, curatt->vallen );
SvUTF8_on(attval);
hv_store( atth, "value", 5, attval, vhash );
@@ -272,7 +272,7 @@
if( numatts ) {
curatt = curnode->firstatt;
for( i = 0; i < numatts; i++ ) {
- if( curatt->value == -1 ) attval = newSVpvn( "1", 1 );
+ if( curatt->value == NULL ) attval = newSVpvn( "1", 1 );
else attval = newSVpvn( curatt->value, curatt->vallen );
SvUTF8_on(attval);
hv_store( output, curatt->name, curatt->namelen, attval, 0 );
--- a/parser.c
+++ b/parser.c
@@ -417,7 +417,7 @@
case 0: last_state = ST_att_name; goto done;
case '/': // self closing !! /> is assumed !!
curatt = nodec_addattr( curnode, attname, attname_len );
- if( !att_has_val ) { curatt->value = -1; curatt->vallen = 0; }
+ if( !att_has_val ) { curatt->value = NULL; curatt->vallen = 0; }
attname_len = 0;
curnode->z = cpos+1-xmlin;
@@ -436,7 +436,7 @@
goto att_space;
case '>':
curatt = nodec_addattr( curnode, attname, attname_len );
- if( !att_has_val ) { curatt->value = -1; curatt->vallen = 0; }
+ if( !att_has_val ) { curatt->value = NULL; curatt->vallen = 0; }
attname_len = 0;
cpos++;
goto val_1;
@@ -832,7 +832,7 @@
switch( let ) {
case '/': // self closing !! /> is assumed !!
curatt = nodec_addattr( curnode, attname, attname_len );
- if( !att_has_val ) { curatt->value = -1; curatt->vallen = 0; }
+ if( !att_has_val ) { curatt->value = NULL; curatt->vallen = 0; }
attname_len = 0;
curnode = curnode->parent;
@@ -850,7 +850,7 @@
goto u_att_space;
case '>':
curatt = nodec_addattr( curnode, attname, attname_len );
- if( !att_has_val ) { curatt->value = -1; curatt->vallen = 0; }
+ if( !att_has_val ) { curatt->value = NULL; curatt->vallen = 0; }
attname_len = 0;
cpos++;
goto u_val_1;