From 1bc61ee3959a47013be5b12a902e4ba575fa2aaa Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 29 Apr 2022 11:04:38 +0200 Subject: (Te_files) make it compile again with rpm < 4.12 Technically the old code would compile up to 4.18 but: - rpmteFI() has been obsoleted in 4.12 - it segfaults (see next commit) whereas new code path works in 4.18 --- RPM4/src/Makefile.PL | 1 + RPM4/src/RPM4.xs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/RPM4/src/Makefile.PL b/RPM4/src/Makefile.PL index 527fb47..025f5c8 100644 --- a/RPM4/src/Makefile.PL +++ b/RPM4/src/Makefile.PL @@ -39,6 +39,7 @@ print $FH ' * $Id$' . "\n"; print $FH " */\n\n"; print $FH "#ifndef RPMVERSION_H\n#define RPMVERSION_H\n\n"; foreach (qw( + 4.12.0 4.12.90 4.15.0 )) { diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs index dbbbd28..5000e7e 100644 --- a/RPM4/src/RPM4.xs +++ b/RPM4/src/RPM4.xs @@ -1957,18 +1957,27 @@ void Te_files(Te) rpmte Te PREINIT: +#if defined(RPM4_12_0) rpmfiles Files; +#endif rpmfi fi; PPCODE: +#if defined(RPM4_12_0) Files = rpmteFiles(Te); fi = rpmfilesIter(Files, RPMFI_ITER_FWD); if (fi != NULL && rpmfiNext(fi) >= 0) { +#else + fi = rpmteFI(Te); + if ((fi = rpmfiInit(fi, 0)) != NULL && rpmfiNext(fi) >= 0) { +#endif mXPUSHs(sv_setref_pv(newSVpvs(""), bless_rpmfi, fi)); #ifdef HDRPMMEM PRINTF_NEW(bless_rpmfi, Files, Files->nrefs); #endif } +#if defined(RPM4_12_0) rpmfilesFree(Files); +#endif MODULE = RPM4 PACKAGE = RPM4 -- cgit v1.2.1