Return-Path: Delivered-To: apmail-httpd-apreq-cvs-archive@www.apache.org Received: (qmail 10718 invoked from network); 11 Jun 2004 03:16:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Jun 2004 03:16:28 -0000 Received: (qmail 29747 invoked by uid 500); 11 Jun 2004 03:16:51 -0000 Delivered-To: apmail-httpd-apreq-cvs-archive@httpd.apache.org Received: (qmail 29705 invoked by uid 500); 11 Jun 2004 03:16:50 -0000 Mailing-List: contact apreq-cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: apreq-dev@httpd.apache.org List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-cvs@httpd.apache.org Received: (qmail 29692 invoked by uid 500); 11 Jun 2004 03:16:50 -0000 Delivered-To: apmail-httpd-apreq-2-cvs@apache.org Received: (qmail 29687 invoked by uid 99); 11 Jun 2004 03:16:50 -0000 Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Thu, 10 Jun 2004 20:16:50 -0700 Received: (qmail 10689 invoked by uid 1221); 11 Jun 2004 03:16:26 -0000 Date: 11 Jun 2004 03:16:26 -0000 Message-ID: <20040611031626.10688.qmail@minotaur.apache.org> From: joes@apache.org To: httpd-apreq-2-cvs@apache.org Subject: cvs commit: httpd-apreq-2/glue/perl/xsbuilder apreq_xs_postperl.h X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N joes 2004/06/10 20:16:26 Modified: glue/perl/xsbuilder apreq_xs_postperl.h Log: Revert sv_magic() calls to the pre-5.8 idiom, otherwise a pre-5.8 sv_magic call will mangle the env pointer (it eventually tries to strcpy env). Revision Changes Path 1.25 +27 -4 httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h Index: apreq_xs_postperl.h =================================================================== RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- apreq_xs_postperl.h 13 Apr 2004 00:41:55 -0000 1.24 +++ apreq_xs_postperl.h 11 Jun 2004 03:16:26 -0000 1.25 @@ -110,8 +110,19 @@ static SV *apreq_xs_c2perl(pTHX_ void *obj, void *env, const char *class) { SV *rv = sv_setref_pv(newSV(0), class, obj); - if (env) - sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0); + if (env) { + /* We use the old idiom for sv_magic() below, + * because perl 5.6 mangles the env pointer on + * the recommended 5.8.x invocation + * + * sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0); + * + * 5.8.x is OK with the old way as well, but in the future + * we may have to use "#if PERL_VERSION < 8" ... + */ + sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, Nullch, -1); + SvMAGIC(SvRV(rv))->mg_ptr = env; + } return rv; } @@ -128,8 +139,20 @@ { SV *sv = (SV *)newHV(); SV *rv = sv_setref_pv(newSV(0), class, obj); - if (env) - sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0); + if (env) { + /* We use the old idiom for sv_magic() below, + * because perl 5.6 mangles the env pointer on + * the recommended 5.8.x invocation + * + * sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0); + * + * 5.8.x is OK with the old way as well, but in the future + * we may have to use "#if PERL_VERSION < 8" ... + */ + sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, Nullch, -1); + SvMAGIC(SvRV(rv))->mg_ptr = env; +#endif + } sv_magic(sv, rv, PERL_MAGIC_tied, Nullch, 0); SvREFCNT_dec(rv); /* corrects SvREFCNT_inc(rv) implicit in sv_magic */