Author: pgollucci Date: Tue Dec 5 02:01:08 2006 New Revision: 482563 URL: http://svn.apache.org/viewvc?view=rev&rev=482563 Log: o Move MP_PERL_VERSION* from modperl_util.h to modperl_common_util.h o add MP_PERL_BRANCH to replace 5_6_x and related o Replace all occurences of PERL_REVISION, PERL_VERSION, PERL_SUBVERSION with calls to the macros.
Modified: perl/modperl/trunk/src/modules/perl/mod_perl.c perl/modperl/trunk/src/modules/perl/modperl_cmd.c perl/modperl/trunk/src/modules/perl/modperl_common_util.c perl/modperl/trunk/src/modules/perl/modperl_common_util.h perl/modperl/trunk/src/modules/perl/modperl_interp.c perl/modperl/trunk/src/modules/perl/modperl_interp.h perl/modperl/trunk/src/modules/perl/modperl_io.h perl/modperl/trunk/src/modules/perl/modperl_perl.c perl/modperl/trunk/src/modules/perl/modperl_perl.h perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h perl/modperl/trunk/src/modules/perl/modperl_perl_pp.h perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c perl/modperl/trunk/src/modules/perl/modperl_util.h Modified: perl/modperl/trunk/src/modules/perl/mod_perl.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/mod_perl.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/mod_perl.c (original) +++ perl/modperl/trunk/src/modules/perl/mod_perl.c Tue Dec 5 02:01:08 2006 @@ -165,8 +165,7 @@ dTHXa(perl); /* 5.7.3+ has a built-in special ${^TAINT}, backport it to 5.6.0+ */ -#if PERL_REVISION == 5 && \ - (PERL_VERSION == 6 || (PERL_VERSION == 7 && PERL_SUBVERSION < 3)) +#if MP_PERL_VERSION_AT_MOST(5, 7, 2) { GV *gv = gv_fetchpv("\024AINT", GV_ADDMULTI, SVt_IV); sv_setiv(GvSV(gv), PL_tainting); @@ -266,7 +265,7 @@ PL_endav = Nullav; /* This was fixed in 5.9.0/5.8.1 (17775), but won't compile after 19122 */ -#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 0 && \ +#if MP_PERL_VERSION(5, 8, 0) && \ defined(USE_REENTRANT_API) && defined(HAS_CRYPT_R) && defined(__GLIBC__) /* workaround perl5.8.0/glibc bug */ PL_reentrant_buffer->_crypt_struct.current_saltbits = 0; @@ -585,13 +584,9 @@ static apr_status_t modperl_sys_term(void *data) { /* PERL_SYS_TERM() needs 'my_perl' as of 5.9.5 */ -#ifdef USE_ITHREADS -# if PERL_REVISION == 5 && \ - ((PERL_VERSION == 9 && PERL_SUBVERSION > 4) || \ - PERL_VERSION > 9) +#if MP_PERL_VERSION_AT_LEAST(5, 9, 5) && defined(USE_ITHREADS) modperl_cleanup_data_t *cdata = (modperl_cleanup_data_t *)data; PerlInterpreter *my_perl = cdata == NULL ? NULL : (PerlInterpreter *)cdata->data; -# endif #endif MP_init_status = 0; MP_threads_started = 0; @@ -712,10 +707,10 @@ } #endif -#if PERL_REVISION == 5 && PERL_VERSION < 9 -#define MP_PERL_VERSION_STAMP "Perl/v%vd" -#else +#if MP_PERL_VERSION_AT_LEAST(5, 9, 0) #define MP_PERL_VERSION_STAMP "Perl/%" SVf +#else +#define MP_PERL_VERSION_STAMP "Perl/v%vd" #endif ap_add_version_component(pconf, MP_VERSION_STRING); Modified: perl/modperl/trunk/src/modules/perl/modperl_cmd.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_cmd.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_cmd.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_cmd.c Tue Dec 5 02:01:08 2006 @@ -564,7 +564,7 @@ GV *gv = gv_fetchpv("0", TRUE, SVt_PV); ENTER;SAVETMPS; save_scalar(gv); /* local $0 */ -#if PERL_REVISION == 5 && PERL_VERSION >= 9 +#if MP_PERL_VERSION_AT_LEAST(5, 9, 0) TAINT_NOT; /* XXX: temp workaround, see my p5p post */ #endif sv_setref_pv(server, "Apache2::ServerRec", (void*)s); Modified: perl/modperl/trunk/src/modules/perl/modperl_common_util.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_common_util.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_common_util.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_common_util.c Tue Dec 5 02:01:08 2006 @@ -23,9 +23,8 @@ #include "modperl_common_util.h" - /* Prefetch magic requires perl 5.8 */ -#if ((PERL_REVISION == 5) && (PERL_VERSION >= 8)) +#if MP_PERL_VERSION_AT_LEAST(5, 8, 0) /* A custom MGVTBL with mg_copy slot filled in allows us to FETCH a * table entry immediately during iteration. For multivalued keys @@ -68,7 +67,7 @@ sv_setref_pv(rsv, classname, p); /* Prefetch magic requires perl 5.8 */ -#if ((PERL_REVISION == 5) && (PERL_VERSION >= 8)) +#if MP_PERL_VERSION_AT_LEAST(5, 8, 0) sv_magicext(hv, NULL, PERL_MAGIC_ext, NULL, Nullch, -1); SvMAGIC(hv)->mg_virtual = (MGVTBL *)&modperl_table_magic_prefetch; Modified: perl/modperl/trunk/src/modules/perl/modperl_common_util.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_common_util.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_common_util.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_common_util.h Tue Dec 5 02:01:08 2006 @@ -1,4 +1,3 @@ - /* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -78,6 +77,18 @@ #define MP_magical_tie(sv, mg_flags) \ SvFLAGS((SV*)sv) |= mg_flags +/* some wrapper macros to detect perl versions + * and prevent code clutter */ +#define MP_PERL_VERSION_AT_LEAST(r, v, s) \ + (PERL_REVISION == r && \ + ((PERL_VERSION == v && PERL_SUBVERSION > s-1) || PERL_VERSION > v)) + +#define MP_PERL_VERSION_AT_MOST(r, v, s) \ + (PERL_REVISION == r && \ + (PERL_VERSION < v || (PERL_VERSION == v && PERL_SUBVERSION < s+1))) + +#define MP_PERL_VERSION(r, v, s) \ + (PERL_REVISION == r && PERL_VERSION == v && PERL_SUBVERSION == s) /* tie %hash */ MP_INLINE SV *modperl_hash_tie(pTHX_ const char *classname, Modified: perl/modperl/trunk/src/modules/perl/modperl_interp.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_interp.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_interp.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_interp.c Tue Dec 5 02:01:08 2006 @@ -79,7 +79,7 @@ interp->perl = perl_clone(perl, clone_flags); -#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 0 && \ +#if MP_PERL_VERSION(5, 8, 0) && \ defined(USE_REENTRANT_API) && defined(HAS_CRYPT_R) && defined(__GLIBC__) { dTHXa(interp->perl); Modified: perl/modperl/trunk/src/modules/perl/modperl_interp.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_interp.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_interp.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_interp.h Tue Dec 5 02:01:08 2006 @@ -36,9 +36,7 @@ * cleaner solution. of course it must be really fast. */ #ifndef HvPMROOT -# if PERL_REVISION == 5 && \ - ((PERL_VERSION == 9 && PERL_SUBVERSION > 4) || \ - PERL_VERSION > 9) +# if MP_PERL_VERSION_AT_LEAST(5, 9, 5) #define MP_THX_INTERP_GET(thx) \ (modperl_interp_t *) ((XPVMG*)SvANY(*Perl_Imodglobal_ptr(thx)))->xmg_u.xmg_magic # else @@ -51,9 +49,7 @@ #endif #ifndef HvPMROOT -# if PERL_REVISION == 5 && \ - ((PERL_VERSION == 9 && PERL_SUBVERSION > 4) || \ - PERL_VERSION > 9) +# if MP_PERL_VERSION_AT_LEAST(5, 9, 5) #define MP_THX_INTERP_SET(thx, interp) \ ((XPVMG*)SvANY(*Perl_Imodglobal_ptr(thx)))->xmg_u.xmg_magic = (MAGIC*)interp # else Modified: perl/modperl/trunk/src/modules/perl/modperl_io.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_io.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_io.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_io.h Tue Dec 5 02:01:08 2006 @@ -24,7 +24,7 @@ * from living in the gv to the GvIOp(gv), so we have to deal * with both to support 5.6.x */ -#if ((PERL_REVISION == 5) && (PERL_VERSION >= 7)) +#if MP_PERL_VERSION_AT_LEAST(5, 7, 0) # define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) #else # define TIEHANDLE_SV(handle) (SV*)handle Modified: perl/modperl/trunk/src/modules/perl/modperl_perl.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_perl.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_perl.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_perl.c Tue Dec 5 02:01:08 2006 @@ -200,8 +200,7 @@ } } -#if !(PERL_REVISION == 5 && ( PERL_VERSION < 8 || \ - (PERL_VERSION == 8 && PERL_SUBVERSION == 0))) && \ +#if !(MP_PERL_VERSION_AT_MOST(5, 8, 0)) && \ (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)) #define MP_NEED_HASH_SEED_FIXUP #endif @@ -258,7 +257,7 @@ { #ifdef MP_NEED_HASH_SEED_FIXUP if (MP_init_hash_seed_set) { -#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 1 +#if MP_PERL_VERSION(5, 8, 1) PL_hash_seed = MP_init_hash_seed; PL_hash_seed_set = MP_init_hash_seed_set; #else Modified: perl/modperl/trunk/src/modules/perl/modperl_perl.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_perl.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_perl.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_perl.h Tue Dec 5 02:01:08 2006 @@ -22,7 +22,7 @@ * need to do that for those fake 5.8.0 as well. real 5.8.0 doesn't * have THREADS_HAVE_PIDS defined. */ -#if PERL_REVISION == 5 && PERL_VERSION >= 8 && THREADS_HAVE_PIDS +#if MP_PERL_VERSION_AT_LEAST(5, 8, 0) && THREADS_HAVE_PIDS #define MP_MAINTAIN_PPID #endif Modified: perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h Tue Dec 5 02:01:08 2006 @@ -77,18 +77,6 @@ # endif #endif -#if (PERL_REVISION == 5) && (PERL_VERSION == 6) -# define MP_PERL_5_6_x -#endif - -#if defined(MP_PERL_5_6_x) && (PERL_SUBVERSION == 0) -# define MP_PERL_5_6_0 -#endif - -#if defined(MP_PERL_5_6_x) && (PERL_SUBVERSION == 1) -# define MP_PERL_5_6_1 -#endif - #include "modperl_perl_unembed.h" /* avoiding -Wall warning */ Modified: perl/modperl/trunk/src/modules/perl/modperl_perl_pp.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_perl_pp.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_perl_pp.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_perl_pp.h Tue Dec 5 02:01:08 2006 @@ -17,7 +17,10 @@ #ifndef MODPERL_PERL_PP_H #define MODPERL_PERL_PP_H -#if defined(USE_ITHREADS) && defined(MP_PERL_5_6_x) +#define MP_PERL_BRANCH(r, v) \ + (PERL_REVISION == r && PERL_VERSION == v) + +#if defined(USE_ITHREADS) && MP_PERL_BRANCH(5, 6) # define MP_REFGEN_FIXUP #endif Modified: perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c Tue Dec 5 02:01:08 2006 @@ -29,7 +29,7 @@ #ifdef USE_ITHREADS -#ifdef MP_PERL_5_6_x +#if MP_PERL_BRANCH(5, 6) # define my_sv_dup(s, p) sv_dup(s) typedef struct { Modified: perl/modperl/trunk/src/modules/perl/modperl_util.h URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_util.h?view=diff&rev=482563&r1=482562&r2=482563 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_util.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_util.h Tue Dec 5 02:01:08 2006 @@ -149,17 +149,4 @@ SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val, request_rec *r, conn_rec *c); -/* some wrapper macros to detect perl versions - * and prevent code clutter */ -#define MP_PERL_VERSION_AT_LEAST(r, v, s) \ - (PERL_REVISION == r && \ - ((PERL_VERSION == v && PERL_SUBVERSION >= s) || PERL_VERSION > v)) - -#define MP_PERL_VERSION_AT_MOST(r, v, s) \ - (PERL_REVISION == r && \ - (PERL_VERSION < v || (PERL_VERSION == v && PERL_SUBVERSION =< s))) - -#define MP_PERL_VERSION(r, v, s) \ - (PERL_REVISION == r && PERL_VERSION == v && PERL_SUBVERSION == s) - #endif /* MODPERL_UTIL_H */