From 13d356f324d3ac73ad7eb9e627a33e3fa89132ec Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Wed, 27 Oct 2010 17:16:27 +0100 Subject: [PATCH] Simplify the conditionals in the XS code for B::COP::{io,warnings} The same post-processed C code will generated as before for PERL_VERSION >= 9, and the same sequence of perl API calls for PERL_VERSION < 9. --- ext/B/B.xs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/ext/B/B.xs b/ext/B/B.xs index 9906dd2..95d76fc 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -1196,10 +1196,6 @@ LOOP_lastop(o) #define COP_arybase(o) CopARYBASE_get(o) #define COP_line(o) CopLINE(o) #define COP_hints(o) CopHINTS_get(o) -#if PERL_VERSION < 9 -# define COP_warnings(o) o->cop_warnings -# define COP_io(o) o->cop_io -#endif MODULE = B PACKAGE = B::COP PREFIX = COP_ @@ -1246,22 +1242,30 @@ U32 COP_line(o) B::COP o -#if PERL_VERSION >= 9 - void COP_warnings(o) B::COP o PPCODE: +#if PERL_VERSION >= 9 ST(0) = make_warnings_object(aTHX_ o->cop_warnings); +#else + ST(0) = make_sv_object(aTHX_ NULL, o->cop_warnings); +#endif XSRETURN(1); void COP_io(o) B::COP o PPCODE: +#if PERL_VERSION >= 9 ST(0) = make_cop_io_object(aTHX_ o); +#else + ST(0) = make_sv_object(aTHX_ NULL, o->cop_io); +#endif XSRETURN(1); +#if PERL_VERSION >= 9 + B::RHE COP_hints_hash(o) B::COP o @@ -1270,16 +1274,6 @@ COP_hints_hash(o) OUTPUT: RETVAL -#else - -B::SV -COP_warnings(o) - B::COP o - -B::SV -COP_io(o) - B::COP o - #endif U32 -- 2.7.4