summaryrefslogtreecommitdiffstats
path: root/RPM4
diff options
context:
space:
mode:
Diffstat (limited to 'RPM4')
-rw-r--r--RPM4/src/Makefile.PL1
-rw-r--r--RPM4/src/RPM4.xs11
2 files changed, 12 insertions, 0 deletions
diff --git a/RPM4/src/Makefile.PL b/RPM4/src/Makefile.PL
index 025f5c8..c39ef23 100644
--- a/RPM4/src/Makefile.PL
+++ b/RPM4/src/Makefile.PL
@@ -42,6 +42,7 @@ foreach (qw(
4.12.0
4.12.90
4.15.0
+ 4.18.0
)) {
my $v = $_;
my $vobj = version->declare("v$_");
diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs
index 5000e7e..0ba8b52 100644
--- a/RPM4/src/RPM4.xs
+++ b/RPM4/src/RPM4.xs
@@ -946,11 +946,22 @@ Header_string(h, no_header_magic = 0)
PREINIT:
char * string = NULL;
char * ptr = NULL;
+#if defined(RPM4_18_0)
unsigned int hsize = 0;
+#else
+ int hsize = 0;
+#endif
PPCODE:
+#if defined(RPM4_18_0)
string = headerExport(h, &hsize);
+#else
+ hsize = headerSizeof(h, no_header_magic ? HEADER_MAGIC_NO : HEADER_MAGIC_YES);
+ string = headerUnload(h);
+#endif
if (! no_header_magic) {
+#if defined(RPM4_18_0)
hsize +=sizeof(header_magic); // Adjust for header_magic
+#endif
ptr = malloc(hsize);
memcpy(ptr, header_magic, 8);
memcpy(ptr + 8, string, hsize - 8);