From 543467136f001708f4c63376ac5d18adde82db30 Mon Sep 17 00:00:00 2001
From: ichizok <gclient.gaap@gmail.com>
Date: Thu, 27 May 2021 18:05:14 +0200
Subject: [PATCH] patch 8.2.2891: cannot build with Perl 5.34

Problem:    Cannot build with Perl 5.34.
Solution:   Add Perl_SvTRUE_common(). (Ozaki Kiichi, closes #8266,
            closes #8250)
---
 src/if_perl.xs | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/if_perl.xs b/src/if_perl.xs
index 99fc3cb..39daa8e 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -692,12 +692,41 @@ S_POPMARK(pTHX)
 /* perl-5.32 needs Perl_POPMARK */
 # if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
 #  define Perl_POPMARK S_POPMARK
+# endif
+
+/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
+PERL_STATIC_INLINE bool
+Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
+{
+    if (UNLIKELY(SvIMMORTAL_INTERP(sv)))
+       return SvIMMORTAL_TRUE(sv);
+
+    if (! SvOK(sv))
+       return FALSE;
+
+    if (SvPOK(sv))
+       return SvPVXtrue(sv);
+
+    if (SvIOK(sv))
+       return SvIVX(sv) != 0; /* casts to bool */
+
+    if (SvROK(sv) && !(SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv)))))
+       return TRUE;
+
+    if (sv_2bool_is_fallback)
+       return sv_2bool_nomg(sv);
+
+    return isGV_with_GP(sv);
+}
+# endif

 /* perl-5.32 needs Perl_SvTRUE */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
 PERL_STATIC_INLINE bool
 Perl_SvTRUE(pTHX_ SV *sv) {
     if (!LIKELY(sv))
-        return FALSE;
+       return FALSE;
     SvGETMAGIC(sv);
     return SvTRUE_nomg_NN(sv);
 }
--
2.27.0