summaryrefslogtreecommitdiff
path: root/src/if_perl.xs
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-05-26 22:10:00 +0200
committerBram Moolenaar <Bram@vim.org>2016-05-26 22:10:00 +0200
commit6727bf861776cfbb93c97dfea5f87a095cf9f364 (patch)
tree2fb2a6d1821aba3b1d3358c78928597646f75ace /src/if_perl.xs
parent13ddc5c35921efa69e980284117b6db6465e019c (diff)
downloadvim-git-6727bf861776cfbb93c97dfea5f87a095cf9f364.tar.gz
patch 7.4.1848v7.4.1848
Problem: Can't build with Strawberry Perl 5.24. Solution: Define S_SvREFCNT_dec() if needed. (Damien, Ken Takata)
Diffstat (limited to 'src/if_perl.xs')
-rw-r--r--src/if_perl.xs32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 23246a57b..aab7ade22 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -299,6 +299,9 @@ typedef int perl_key;
# define PerlIOBase_pushed dll_PerlIOBase_pushed
# define PerlIO_define_layer dll_PerlIO_define_layer
# endif
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 24)
+# define Perl_savetmps dll_Perl_savetmps
+# endif
/*
* Declare HANDLE for perl.dll and function pointers.
@@ -455,6 +458,9 @@ static NV (*Perl_sv_2nv_flags)(pTHX_ SV *const, const I32);
static IV (*PerlIOBase_pushed)(pTHX_ PerlIO *, const char *, SV *, PerlIO_funcs *);
static void (*PerlIO_define_layer)(pTHX_ PerlIO_funcs *);
#endif
+#if (PERL_REVISION == 5) && (PERL_VERSION >= 24)
+static void (*Perl_savetmps)(pTHX);
+#endif
/*
* Table of name to function pointer of perl.
@@ -598,17 +604,27 @@ static struct {
{"PerlIOBase_pushed", (PERL_PROC*)&PerlIOBase_pushed},
{"PerlIO_define_layer", (PERL_PROC*)&PerlIO_define_layer},
#endif
+#if (PERL_REVISION == 5) && (PERL_VERSION >= 24)
+ {"Perl_savetmps", (PERL_PROC*)&Perl_savetmps},
+#endif
{"", NULL},
};
/* Work around for perl-5.18.
- * The definitions of S_SvREFCNT_inc and S_SvREFCNT_dec are needed, so include
- * "perl\lib\CORE\inline.h", after Perl_sv_free2 is defined.
- * The linker won't complain about undefined __impl_Perl_sv_free2. */
+ * For now, only the definitions of S_SvREFCNT_dec are needed in
+ * "perl\lib\CORE\inline.h". */
#if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
-# define PL_memory_wrap "panic: memory wrap" /* Dummy */
-# include <inline.h>
-# undef PL_memory_wrap
+static void
+S_SvREFCNT_dec(pTHX_ SV *sv)
+{
+ if (LIKELY(sv != NULL)) {
+ U32 rc = SvREFCNT(sv);
+ if (LIKELY(rc > 1))
+ SvREFCNT(sv) = rc - 1;
+ else
+ Perl_sv_free2(aTHX_ sv, rc);
+ }
+}
#endif
/*
@@ -777,7 +793,7 @@ newWINrv(SV *rv, win_T *ptr)
sv_setiv(ptr->w_perl_private, PTR2IV(ptr));
}
else
- SvREFCNT_inc(ptr->w_perl_private);
+ SvREFCNT_inc_void_NN(ptr->w_perl_private);
SvRV(rv) = ptr->w_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIWIN", TRUE));
@@ -793,7 +809,7 @@ newBUFrv(SV *rv, buf_T *ptr)
sv_setiv(ptr->b_perl_private, PTR2IV(ptr));
}
else
- SvREFCNT_inc(ptr->b_perl_private);
+ SvREFCNT_inc_void_NN(ptr->b_perl_private);
SvRV(rv) = ptr->b_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIBUF", TRUE));