Subject: | [PATCH] Fix for perl 5.19.4-to-be |
Perl 5.19.4 and up use NULL to represent nonexistent array elements. This causes Mouse to crash. The attached patch is one possible way to fix this.
Subject: | open_56GGGm4h.txt |
diff -rup Mouse-1.11-2l40Hq/mouse.h Mouse-1.11-8jslEf/mouse.h
--- Mouse-1.11-2l40Hq/mouse.h 2012-08-26 18:23:13.000000000 -0700
+++ Mouse-1.11-8jslEf/mouse.h 2013-08-30 12:59:26.000000000 -0700
@@ -90,10 +90,11 @@ MAGIC* mouse_mg_find(pTHX_ SV* const sv,
/* MOUSE_av_at(av, ix) is the safer version of AvARRAY(av)[ix] if perl is compiled with -DDEBUGGING */
#ifdef DEBUGGING
-#define MOUSE_av_at(av, ix) *mouse_av_at_safe(aTHX_ (av) , (ix))
-SV** mouse_av_at_safe(pTHX_ AV* const mi, I32 const ix);
+#define MOUSE_av_at(av, ix) mouse_av_at_safe(aTHX_ (av) , (ix))
+SV* mouse_av_at_safe(pTHX_ AV* const mi, I32 const ix);
#else
-#define MOUSE_av_at(av, ix) AvARRAY(av)[ix]
+#define MOUSE_av_at(av, ix) \
+ (AvARRAY(av)[ix] ? AvARRAY(av)[ix] : &PL_sv_undef)
#endif
#define MOUSE_mg_obj(mg) ((mg)->mg_obj)
diff -rup Mouse-1.11-2l40Hq/xs-src/MouseUtil.xs Mouse-1.11-8jslEf/xs-src/MouseUtil.xs
--- Mouse-1.11-2l40Hq/xs-src/MouseUtil.xs 2013-04-24 21:49:45.000000000 -0700
+++ Mouse-1.11-8jslEf/xs-src/MouseUtil.xs 2013-08-30 12:59:37.000000000 -0700
@@ -76,12 +76,12 @@ mouse_mro_get_linear_isa(pTHX_ HV* const
#endif /* !no_mor_get_linear_isa */
#ifdef DEBUGGING
-SV**
+SV*
mouse_av_at_safe(pTHX_ AV* const av, I32 const ix){
assert(av);
assert(SvTYPE(av) == SVt_PVAV);
assert(AvMAX(av) >= ix);
- return &AvARRAY(av)[ix];
+ return AvARRAY(av)[ix] ? AvARRAY(av)[ix] : &PL_sv_undef;
}
#endif