changeset 9129:95fd0de7a8f1 v7.4.1848

commit https://github.com/vim/vim/commit/6727bf861776cfbb93c97dfea5f87a095cf9f364 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 26 22:10:00 2016 +0200 patch 7.4.1848 Problem: Can't build with Strawberry Perl 5.24. Solution: Define S_SvREFCNT_dec() if needed. (Damien, Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Thu, 26 May 2016 22:15:05 +0200
parents 4e1ba20d6cda
children 3924acee7349
files src/if_perl.xs src/version.c
diffstat 2 files changed, 26 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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 
 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));
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1848,
+/**/
     1847,
 /**/
     1846,