cvs commit: modperl-2.0/src/modules/perl modperl_io.c
dougm 02/03/23 18:36:41 Modified:src/modules/perl modperl_io.c Log: figure out which tiehandle SV to use at compile as 1.x does, rather than at runtime Revision ChangesPath 1.7 +12 -10modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_io.c 8 Jan 2002 19:04:22 - 1.6 +++ modperl_io.c 24 Mar 2002 02:36:41 - 1.7 -1,5 +1,11 #include mod_perl.h +#if ((PERL_REVISION == 5) (PERL_VERSION = 7)) +# define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) +#else +# define TIEHANDLE_SV(handle) (SV*)handle +#endif + #define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO) #define TIEHANDLE(handle,r) \ -16,20 +22,17 MP_INLINE void modperl_io_handle_untie(pTHX_ GV *handle) { #ifdef MP_TRACE -if (mg_find((SV*)handle, 'q') || -mg_find((SV*)GvIOp(handle), 'q')) -{ +if (mg_find(TIEHANDLE_SV(handle), 'q')) { MP_TRACE_g(MP_FUNC, untie *%s(0x%lx), REFCNT=%d\n, GvNAME(handle), (unsigned long)handle, - SvREFCNT((SV*)handle)); + SvREFCNT(TIEHANDLE_SV(handle))); } else { return; } #endif -sv_unmagic((SV*)handle, 'q'); -sv_unmagic((SV*)GvIOp(handle), 'q'); +sv_unmagic(TIEHANDLE_SV(handle), 'q'); } MP_INLINE void modperl_io_handle_tie(pTHX_ GV *handle, -39,20 +42,19 modperl_io_handle_untie(aTHX_ handle); -sv_magic((SV*)handle, obj, 'q', Nullch, 0); -sv_magic((SV*)GvIOp(handle), obj, 'q', Nullch, 0); +sv_magic(TIEHANDLE_SV(handle), obj, 'q', Nullch, 0); SvREFCNT_dec(obj); /* since sv_magic did SvREFCNT_inc */ MP_TRACE_g(MP_FUNC, tie *%s(0x%lx) = %s, REFCNT=%d\n, GvNAME(handle), (unsigned long)handle, classname, - SvREFCNT((SV*)handle)); + SvREFCNT(TIEHANDLE_SV(handle))); } MP_INLINE int modperl_io_handle_tied(pTHX_ GV *handle, char *classname) { MAGIC *mg; -SV *sv = SvMAGICAL(GvIOp(handle)) ? (SV*)GvIOp(handle) : (SV*)handle; +SV *sv = TIEHANDLE_SV(handle); if (SvMAGICAL(sv) (mg = mg_find(sv, 'q'))) { char *package = HvNAME(SvSTASH((SV*)SvRV(mg-mg_obj)));
cvs commit: modperl-2.0/src/modules/perl modperl_io.c
dougm 02/01/08 11:04:22 Modified:src/modules/perl modperl_io.c Log: plug leaking tied STD{IN,OUT} objects Revision ChangesPath 1.6 +2 -0 modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- modperl_io.c 6 Jan 2002 21:56:22 - 1.5 +++ modperl_io.c 8 Jan 2002 19:04:22 - 1.6 @@ -42,6 +42,8 @@ sv_magic((SV*)handle, obj, 'q', Nullch, 0); sv_magic((SV*)GvIOp(handle), obj, 'q', Nullch, 0); +SvREFCNT_dec(obj); /* since sv_magic did SvREFCNT_inc */ + MP_TRACE_g(MP_FUNC, tie *%s(0x%lx) = %s, REFCNT=%d\n, GvNAME(handle), (unsigned long)handle, classname, SvREFCNT((SV*)handle));
cvs commit: modperl-2.0/src/modules/perl modperl_io.c
dougm 01/09/12 21:10:55 Modified:src/modules/perl modperl_io.c Removed: lib/ModPerl XSLoader.pm Log: fix tied filehandle breakage caused by bleedperl change #11639 Revision ChangesPath 1.4 +9 -1 modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- modperl_io.c 2001/08/01 16:52:40 1.3 +++ modperl_io.c 2001/09/13 04:10:55 1.4 @@ -8,9 +8,15 @@ #define TIED(handle) \ modperl_io_handle_tied(aTHX_ handle, Apache::RequestRec) +/* + * XXX: bleedperl change #11639 switch tied handle magic + * from living in the gv to the GvIOp(gv), so we have to deal + * with both to support 5.6.x + */ MP_INLINE void modperl_io_handle_untie(pTHX_ GV *handle) { sv_unmagic((SV*)handle, 'q'); +sv_unmagic((SV*)GvIOp(handle), 'q'); MP_TRACE_g(MP_FUNC, untie *%s(0x%lx), REFCNT=%d\n, GvNAME(handle), (unsigned long)handle, @@ -27,6 +33,7 @@ } sv_magic((SV*)handle, obj, 'q', Nullch, 0); +sv_magic((SV*)GvIOp(handle), obj, 'q', Nullch, 0); MP_TRACE_g(MP_FUNC, tie *%s(0x%lx) = %s, REFCNT=%d\n, GvNAME(handle), (unsigned long)handle, classname, @@ -36,8 +43,9 @@ MP_INLINE int modperl_io_handle_tied(pTHX_ GV *handle, char *classname) { MAGIC *mg; +SV *sv = SvMAGICAL(GvIOp(handle)) ? (SV*)GvIOp(handle) : (SV*)handle; -if (SvMAGICAL(handle) (mg = mg_find((SV*)handle, 'q'))) { +if (SvMAGICAL(sv) (mg = mg_find(sv, 'q'))) { char *package = HvNAME(SvSTASH((SV*)SvRV(mg-mg_obj))); if (!strEQ(package, classname)) {
cvs commit: modperl-2.0/src/modules/perl modperl_io.c
dougm 01/08/01 09:52:41 Modified:src/modules/perl modperl_io.c Log: better tracing of tie/untie STDIN/STDOUT Revision ChangesPath 1.3 +13 -7 modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- modperl_io.c 2001/07/13 17:12:12 1.2 +++ modperl_io.c 2001/08/01 16:52:40 1.3 @@ -11,14 +11,26 @@ MP_INLINE void modperl_io_handle_untie(pTHX_ GV *handle) { sv_unmagic((SV*)handle, 'q'); + +MP_TRACE_g(MP_FUNC, untie *%s(0x%lx), REFCNT=%d\n, + GvNAME(handle), (unsigned long)handle, + SvREFCNT((SV*)handle)); } MP_INLINE void modperl_io_handle_tie(pTHX_ GV *handle, char *classname, void *ptr) { SV *obj = modperl_ptr2obj(aTHX_ classname, ptr); -modperl_io_handle_untie(aTHX_ handle); + +if (mg_find((SV*)handle, 'q')) { +modperl_io_handle_untie(aTHX_ handle); +} + sv_magic((SV*)handle, obj, 'q', Nullch, 0); + +MP_TRACE_g(MP_FUNC, tie *%s(0x%lx) = %s, REFCNT=%d\n, + GvNAME(handle), (unsigned long)handle, classname, + SvREFCNT((SV*)handle)); } MP_INLINE int modperl_io_handle_tied(pTHX_ GV *handle, char *classname) @@ -52,9 +64,6 @@ IoFLUSH_off(PL_defoutgv); /* $|=0 */ -MP_TRACE_g(MP_FUNC, tie *STDOUT(0x%lx) = Apache::RequestRec\n, - (unsigned long)handle); - TIEHANDLE(handle, r); return handle; @@ -73,9 +82,6 @@ if (TIED(handle)) { return handle; } - -MP_TRACE_g(MP_FUNC, tie *STDIN(0x%lx) = Apache::RequestRec\n, - (unsigned long)handle); TIEHANDLE(handle, r);