Author: stevehay
Date: Fri Jul 13 01:21:11 2007
New Revision: 555908
URL: http://svn.apache.org/viewvc?view=rev&rev=555908
Log:
Don't call av_undef() on a NULL AV*.
This fixes some horrible nastiness when using perl-5.9.5, which no longer
returns early from av_undef() in the case that the AV* is NULL, as of perl
change #26513.
Modified:
perl/modperl/branches/1.x/src/modules/perl/mod_perl.c
perl/modperl/branches/1.x/src/modules/perl/mod_perl.h
Modified: perl/modperl/branches/1.x/src/modules/perl/mod_perl.c
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/1.x/src/modules/perl/mod_perl.c?view=diff&rev=555908&r1=555907&r2=555908
==============================================================================
--- perl/modperl/branches/1.x/src/modules/perl/mod_perl.c (original)
+++ perl/modperl/branches/1.x/src/modules/perl/mod_perl.c Fri Jul 13 01:21:11
2007
@@ -277,13 +277,8 @@
mp_request_rec = 0;
- av_undef(orig_inc);
- SvREFCNT_dec((SV*)orig_inc);
- orig_inc = Nullav;
-
- av_undef(cleanup_av);
- SvREFCNT_dec((SV*)cleanup_av);
- cleanup_av = Nullav;
+ MP_safe_av_undef(orig_inc)
+ MP_safe_av_undef(cleanup_av)
#ifdef PERL_STACKED_HANDLERS
hv_undef(stacked_handlers);
@@ -1159,9 +1154,7 @@
perl_clear_env();
/* reset @INC */
- av_undef(GvAV(incgv));
- SvREFCNT_dec(GvAV(incgv));
- GvAV(incgv) = Nullav;
+ MP_safe_av_undef(GvAV(incgv))
GvAV(incgv) = av_copy_array(orig_inc);
/* reset $/ */
Modified: perl/modperl/branches/1.x/src/modules/perl/mod_perl.h
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/1.x/src/modules/perl/mod_perl.h?view=diff&rev=555908&r1=555907&r2=555908
==============================================================================
--- perl/modperl/branches/1.x/src/modules/perl/mod_perl.h (original)
+++ perl/modperl/branches/1.x/src/modules/perl/mod_perl.h Fri Jul 13 01:21:11
2007
@@ -301,6 +301,13 @@
#define av_copy_array(av) av_make(av_len(av)+1, AvARRAY(av))
+#define MP_safe_av_undef(av) \
+if (av != Nullav) { \
+ av_undef(av); \
+ SvREFCNT_dec((SV*)av); \
+ av = Nullav; \
+}
+
#ifndef newRV_noinc
#define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv)
#endif