Torsten Förtsch wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

the attached patch makes Apache::Filter::remove work also for nativ filters.

Why do I need this?

[explanation snipped]

I see no reason why we shouldn't support that.

--- mod_perl-1.99_16/xs/Apache/Filter/Apache__Filter.h~ 2004-07-12 09:32:07.000000000 +0200
+++ mod_perl-1.99_16/xs/Apache/Filter/Apache__Filter.h 2004-10-21 13:52:13.243774248 +0200
@@ -277,12 +277,85 @@
}
static MP_INLINE
+void mpxs_Apache__Filter_remove_native_filter(pTHX_ ap_filter_t* f)
+{
+ ap_filter_t *list;
+
+ if( f->c ) {
+ for( list=f->c->input_filters; list; list=list->next ) {
+ if( list==f ) {
+ ap_remove_input_filter(f);
+ return;
+ }
+ }
+ }

[ snipped other filter chains traversals ]

but why do you need to traverse all these lists? is it because we don't know whether the given filter is an input filter or output one? May be it's easier to attach some flag to the filter object to say which kind of filter is that?

+static MP_INLINE
void mpxs_Apache__Filter_remove(pTHX_ I32 items, SV **MARK, SV **SP)
{
modperl_filter_t *modperl_filter;
ap_filter_t *f;
- mpxs_usage_va_1(modperl_filter, "$filter->remove()");
+ if (items < 1) {
+ Perl_croak(aTHX_ "usage: $filter->remove()");
+ }
+
+ modperl_filter = mp_xs_sv2_modperl_filter(*MARK);
+
+ if( !modperl_filter ) { /* native filter */
+ mpxs_Apache__Filter_remove_native_filter(aTHX_ (ap_filter_t*)SvIV(SvRV(*MARK)));
+ return;
+ }
+
f = modperl_filter->f;
MP_TRACE_f(MP_FUNC, " %s\n\n\tfilter removes itself\n",

Also if you could add a test, that will save some time to us. e.g. take the t/filter/TestFilter/both_str_req_mix.pm as the base (could probably simplify it a bit to just test that it can be removed both on input and output). to make your work easier you could just start messing with this test and then post it or if you know A-T better you could start a new test



-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to