From fd92456cd2d2388153a2f8ddc7eaff2ed9e53167 Mon Sep 17 00:00:00 2001
From: Christophe Jaillet
struct dummy_state { +Example code to maintain filter state
struct dummy_state { apr_bucket_brigade *tmpbb; int filter_state; - .... + ... }; apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb) @@ -321,7 +321,7 @@ apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb) /* First invocation for this response: initialise state structure. */ - f->ctx = state = apr_palloc(sizeof *state, f->r->pool); + f->ctx = state = apr_palloc(f->r->pool, sizeof *state); state->tmpbb = apr_brigade_create(f->r->pool, f->c->bucket_alloc); state->filter_state = ...; diff --git a/docs/manual/developer/output-filters.xml b/docs/manual/developer/output-filters.xml index ce9a968914..afa61da162 100644 --- a/docs/manual/developer/output-filters.xml +++ b/docs/manual/developer/output-filters.xml @@ -309,12 +309,12 @@ while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) { a new brigade per invocation as described in the Brigade structure section. -Example code to maintain filter state -+ Example code to maintain filter state +struct dummy_state { apr_bucket_brigade *tmpbb; int filter_state; - .... + ... }; apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb) @@ -327,7 +327,7 @@ apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb) /* First invocation for this response: initialise state structure. */ - f->ctx = state = apr_palloc(sizeof *state, f->r->pool); + f->ctx = state = apr_palloc(f->r->pool, sizeof *state); state->tmpbb = apr_brigade_create(f->r->pool, f->c->bucket_alloc); state->filter_state = ...; -- 2.40.0