summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2022-04-27 01:33:35 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2022-04-27 02:08:39 +0200
commitf6d333affb60e5364bf30355869fd359da2317e8 (patch)
tree928eedb77b3d0e82609fcfd184eaee99439d3888
parentab1249d6ad5af36cc8bf2e8e7c9051b13943ebd6 (diff)
downloadperl-RPM4-f6d333affb60e5364bf30355869fd359da2317e8.tar
perl-RPM4-f6d333affb60e5364bf30355869fd359da2317e8.tar.gz
perl-RPM4-f6d333affb60e5364bf30355869fd359da2317e8.tar.bz2
perl-RPM4-f6d333affb60e5364bf30355869fd359da2317e8.tar.xz
perl-RPM4-f6d333affb60e5364bf30355869fd359da2317e8.zip
Prepare for rpm-4.19: switch away from rpmteFI()
Test Te->files btw (which shows it was segfaulting before...)
-rw-r--r--RPM4/NEWS3
-rw-r--r--RPM4/src/RPM4.xs12
-rw-r--r--RPM4/t/05transaction.t1
3 files changed, 12 insertions, 4 deletions
diff --git a/RPM4/NEWS b/RPM4/NEWS
index 70e15bf..92d9590 100644
--- a/RPM4/NEWS
+++ b/RPM4/NEWS
@@ -1,3 +1,6 @@
+- Adapt for rpm-4.19
+- Fix Te->file segfaulting
+
Version 0.45 - 27 April 2022
- Fix detecting 4.18-alpha1
diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs
index 3f252dc..71e23fa 100644
--- a/RPM4/src/RPM4.xs
+++ b/RPM4/src/RPM4.xs
@@ -1957,15 +1957,19 @@ void
Te_files(Te)
rpmte Te
PREINIT:
- rpmfi Files;
+ rpmfiles Files;
+ rpmfi fi;
PPCODE:
- Files = rpmteFI(Te);
- if ((Files = rpmfiInit(Files, 0)) != NULL && rpmfiNext(Files) >= 0) {
- mXPUSHs(sv_setref_pv(newSVpvs(""), bless_rpmfi, Files));
+ Files = rpmteFiles(Te);
+ fi = rpmfilesIter(Files, RPMFI_ITER_FWD);
+ if (fi != NULL && rpmfiNext(fi) >= 0) {
+ mXPUSHs(sv_setref_pv(newSVpvs(""), bless_rpmfi, fi));
#ifdef HDRPMMEM
PRINTF_NEW(bless_rpmfi, Files, Files->nrefs);
#endif
}
+ rpmfiFree(fi);
+ rpmfilesFree(Files);
MODULE = RPM4 PACKAGE = RPM4
diff --git a/RPM4/t/05transaction.t b/RPM4/t/05transaction.t
index 2a27ae8..18c8c17 100644
--- a/RPM4/t/05transaction.t
+++ b/RPM4/t/05transaction.t
@@ -56,6 +56,7 @@ ok($h, "Reading the header works");
ok($ts->transadd($h, "$Bin/test-rpm-1.0-1mdk.noarch.rpm") == 0, "Adding a package to transaction works");
ok($ts->traverse_transaction(sub {
ok($_[0]->fullname, "Can get name from te");
+ ok($_[0]->files, "Can get files from te");
ok($_[0]->type, "Can get type from te");
}), "traverse_transaction works");