httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-2.0/src/main util_filter.c
Date Sat, 18 Nov 2000 19:37:48 GMT
With this combo, the error message in add_any_filter() (when a filter isn't
found) should probably be fixed.

Cheers,
-g

On Sat, Nov 18, 2000 at 06:57:18PM -0000, rbb@locus.apache.org wrote:
> rbb         00/11/18 10:57:18
> 
>   Modified:    src/main util_filter.c
>   Log:
>   Remove some common code in adding filters to either the input or
>   output filter lists.
>   Submitted by:	Sascha Schumann <sascha@schumann.cx>
>   
>   Revision  Changes    Path
>   1.39      +20 -41    apache-2.0/src/main/util_filter.c
>   
>   Index: util_filter.c
>   ===================================================================
>   RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
>   retrieving revision 1.38
>   retrieving revision 1.39
>   diff -u -r1.38 -r1.39
>   --- util_filter.c	2000/11/09 10:21:12	1.38
>   +++ util_filter.c	2000/11/18 18:57:17	1.39
>   @@ -121,16 +121,17 @@
>        register_filter(name, f, ftype, &registered_output_filters);
>    }
>    
>   -AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx, 
>   -                                     request_rec *r, conn_rec *c)
>   +static void add_any_filter(const char *name, void *ctx, 
>   +                                      request_rec *r, conn_rec *c, 
>   +                                      ap_filter_rec_t *frec,
>   +                                      ap_filter_t **r_filters,
>   +                                      ap_filter_t **c_filters)
>    {
>   -    ap_filter_rec_t *frec = registered_input_filters;
>   -
>        for (; frec != NULL; frec = frec->next) {
>            if (!strcasecmp(name, frec->name)) {
>                apr_pool_t *p = r ? r->pool : c->pool;
>                ap_filter_t *f = apr_pcalloc(p, sizeof(*f));
>   -            ap_filter_t **outf = r ? &r->input_filters : &c->input_filters;
>   +            ap_filter_t **outf = r ? r_filters : c_filters;
>    
>                f->frec = frec;
>                f->ctx = ctx;
>   @@ -157,6 +158,20 @@
>                     "an unknown input filter was not added: %s", name);
>    }
>    
>   +AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx,
>   +                                                request_rec *r, conn_rec *c)
>   +{
>   +    add_any_filter(name, ctx, r, c, registered_input_filters,
>   +            r ? &r->input_filters : NULL, &c->input_filters);
>   +}
>   +
>   +AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx,
>   +                                                request_rec *r, conn_rec *c)
>   +{
>   +    add_any_filter(name, ctx, r, c, registered_output_filters,
>   +            r ? &r->output_filters : NULL, &c->output_filters);
>   +}
>   +
>    AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f)
>    {
>        ap_filter_t *curr;
>   @@ -180,42 +195,6 @@
>            }
>        }
>        curr->next = f->next;
>   -}
>   -
>   -AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx, 
>   -                                      request_rec *r, conn_rec *c)
>   -{
>   -    ap_filter_rec_t *frec = registered_output_filters;
>   -
>   -    for (; frec != NULL; frec = frec->next) {
>   -        if (!strcasecmp(name, frec->name)) {
>   -            apr_pool_t *p = r ? r->pool : c->pool;
>   -            ap_filter_t *f = apr_pcalloc(p, sizeof(*f));
>   -            ap_filter_t **outf = r ? &r->output_filters : &c->output_filters;
>   -
>   -            f->frec = frec;
>   -            f->ctx = ctx;
>   -            f->r = r;
>   -            f->c = c;
>   -
>   -            if (INSERT_BEFORE(f, *outf)) {
>   -                f->next = *outf;
>   -                *outf = f;
>   -            }
>   -            else {
>   -                ap_filter_t *fscan = *outf;
>   -                while (!INSERT_BEFORE(f, fscan->next))
>   -                    fscan = fscan->next;
>   -                f->next = fscan->next;
>   -                fscan->next = f;
>   -            }
>   -
>   -            return;
>   -        }
>   -    }
>   -
>   -    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
>   -                 "an unknown output filter was not added: %s", name);
>    }
>    
>    /* 
>   
>   
>   

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message