cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 02/01/07 16:04:33 Modified:src/modules/perl modperl_filter.c Log: fix leak where Apache::Filter objects needlessly contained a reference loop Revision ChangesPath 1.29 +1 -1 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- modperl_filter.c 21 Oct 2001 22:11:34 - 1.28 +++ modperl_filter.c 8 Jan 2002 00:04:33 - 1.29 @@ -103,7 +103,7 @@ static void modperl_filter_mg_set(pTHX_ SV *obj, modperl_filter_t *filter) { -sv_magic(SvRV(obj), obj, '~', NULL, 0); +sv_magic(SvRV(obj), Nullsv, '~', NULL, -1); SvMAGIC(SvRV(obj))->mg_ptr = (char *)filter; }
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c modperl_handler.c modperl_log.c modperl_perl_includes.h
dougm 01/10/21 15:11:34 Modified:src/modules/perl modperl_filter.c modperl_handler.c modperl_log.c modperl_perl_includes.h Log: tweaks so we could compile without -DPERL_CORE on win32 Revision ChangesPath 1.28 +2 -1 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- modperl_filter.c 2001/10/14 17:18:10 1.27 +++ modperl_filter.c 2001/10/21 22:11:34 1.28 @@ -556,7 +556,7 @@ { apr_bucket *bucket; int i = 0; - +#ifndef WIN32 if (fp == NULL) { fp = stderr; } @@ -572,4 +572,5 @@ (unsigned long)bucket->data); i++; } +#endif } 1.10 +2 -0 modperl-2.0/src/modules/perl/modperl_handler.c Index: modperl_handler.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_handler.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- modperl_handler.c 2001/04/19 17:57:15 1.9 +++ modperl_handler.c 2001/10/21 22:11:34 1.10 @@ -215,7 +215,9 @@ if (!avp) { /* should never happen */ +#if 0 fprintf(stderr, "PANIC: no such handler type: %d\n", type); +#endif return NULL; } 1.5 +4 -0 modperl-2.0/src/modules/perl/modperl_log.c Index: modperl_log.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- modperl_log.c 2000/06/20 16:04:40 1.4 +++ modperl_log.c 2001/10/21 22:11:34 1.5 @@ -1,9 +1,12 @@ #include "mod_perl.h" +#undef getenv /* from XSUB.h */ + U32 MP_debug_level = 0; void modperl_trace(char *func, const char *fmt, ...) { +#ifndef WIN32 /* XXX */ va_list args; if (func) { @@ -13,6 +16,7 @@ va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); +#endif } void modperl_trace_level_set(const char *level) 1.7 +12 -0 modperl-2.0/src/modules/perl/modperl_perl_includes.h Index: modperl_perl_includes.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_includes.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_perl_includes.h 2001/09/25 19:44:02 1.6 +++ modperl_perl_includes.h 2001/10/21 22:11:34 1.7 @@ -38,6 +38,18 @@ /* avoiding namespace collisions */ +/* from XSUB.h */ +/* mod_perl.c calls exit() in a few places */ +#undef exit +/* modperl_tipool.c references abort() */ +#undef abort +/* these three clash with apr bucket structure member names */ +#undef link +#undef read +#undef free +/* modperl_perl.c */ +#undef getpid + #ifdef list # undef list #endif
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c modperl_util.h
dougm 01/10/14 10:18:11 Modified:src/modules/perl modperl_filter.c modperl_util.h Log: function pointer typedefs need _stdcall #ifdef WIN32 Submitted by: Randy Kobes <[EMAIL PROTECTED]> Reviewed by: dougm Revision ChangesPath 1.27 +2 -2 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- modperl_filter.c 2001/10/06 21:05:40 1.26 +++ modperl_filter.c 2001/10/14 17:18:10 1.27 @@ -414,8 +414,8 @@ } } -typedef ap_filter_t * (*filter_add_t) (const char *, void *, - request_rec *, conn_rec *); +typedef ap_filter_t * MP_FUNC_T(filter_add_t) (const char *, void *, + request_rec *, conn_rec *); static int modperl_filter_register_connection(conn_rec *c, int idx, 1.26 +6 -0 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- modperl_util.h2001/10/13 03:22:15 1.25 +++ modperl_util.h2001/10/14 17:18:10 1.26 @@ -7,6 +7,12 @@ #define MP_INLINE APR_INLINE #endif +#ifdef WIN32 +# define MP_FUNC_T(name) (_stdcall *name) +#else +# define MP_FUNC_T(name) (*name) +#endif + #ifndef strcaseEQ # define strcaseEQ(s1,s2) (!strcasecmp(s1,s2)) #endif
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 01/07/15 16:42:06 Modified:src/modules/perl modperl_filter.c Log: fix cut-n-pasto spotted by barries Revision ChangesPath 1.22 +2 -2 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- modperl_filter.c 2001/07/15 22:33:48 1.21 +++ modperl_filter.c 2001/07/15 23:42:06 1.22 @@ -466,9 +466,9 @@ ap_filter_t *f = filters; while (f) { -const char *name = f->frec->name; +const char *fname = f->frec->name; -if (*name == 'M' && strEQ(name, name)) { +if (*fname == 'M' && strEQ(fname, name)) { modperl_handler_t *ctx_handler = ((modperl_filter_ctx_t *)f->ctx)->handler;
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c modperl_filter.h
dougm 01/04/19 17:43:47 Modified:src/modules/perl modperl_filter.c modperl_filter.h Log: remove dead code Revision ChangesPath 1.16 +0 -11 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- modperl_filter.c 2001/04/20 00:38:08 1.15 +++ modperl_filter.c 2001/04/20 00:43:47 1.16 @@ -122,17 +122,6 @@ return status; } -MP_INLINE modperl_filter_t *modperl_sv2filter(pTHX_ SV *sv) -{ -modperl_filter_t *filter = NULL; - -if (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG)) { -filter = (modperl_filter_t *)SvIV((SV*)SvRV(sv)); -} - -return filter; -} - /* output filters */ MP_INLINE static apr_status_t send_eos(ap_filter_t *f) 1.5 +0 -2 modperl-2.0/src/modules/perl/modperl_filter.h Index: modperl_filter.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- modperl_filter.h 2001/04/20 00:38:08 1.4 +++ modperl_filter.h 2001/04/20 00:43:47 1.5 @@ -27,8 +27,6 @@ int modperl_run_filter(modperl_filter_t *filter, ap_input_mode_t mode); -MP_INLINE modperl_filter_t *modperl_sv2filter(pTHX_ SV *sv); - /* output filters */ apr_status_t modperl_output_filter_handler(ap_filter_t *f, apr_bucket_brigade *bb);
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 01/04/19 10:58:26 Modified:src/modules/perl modperl_filter.c Log: use modperl_handler_equal() rather than modperl_mgv_equal() Revision ChangesPath 1.13 +1 -2 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- modperl_filter.c 2001/04/19 17:44:17 1.12 +++ modperl_filter.c 2001/04/19 17:58:25 1.13 @@ -433,8 +433,7 @@ modperl_handler_t *ctx_handler = ((modperl_filter_ctx_t *)f->ctx)->handler; -if (modperl_mgv_equal(ctx_handler->mgv_cv, - handlers[i]->mgv_cv)) { +if (modperl_handler_equal(ctx_handler, handlers[i])) { /* skip if modperl_input_filter_register_connection * already registered this handler * XXX: set a flag in the modperl_handler_t instead
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 01/04/17 21:37:47 Modified:src/modules/perl modperl_filter.c Log: pass the APR::Brigade to filter handlers Revision ChangesPath 1.11 +1 -0 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- modperl_filter.c 2001/03/16 07:30:22 1.10 +++ modperl_filter.c 2001/04/18 04:37:46 1.11 @@ -95,6 +95,7 @@ modperl_handler_make_args(aTHX_ &args, filter_classes[filter->mode], filter, + "APR::Brigade", filter->bb, NULL); if ((status = modperl_callback(aTHX_ handler, p, s, args)) != OK) {
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c modperl_interp.h
dougm 01/03/13 16:03:31 Modified:src/modules/perl modperl_filter.c modperl_interp.h Log: add MP_dINTERP_SELECT macro so caller doesnt need to deal with THX Revision ChangesPath 1.7 +1 -6 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_filter.c 2001/03/13 23:55:19 1.6 +++ modperl_filter.c 2001/03/14 00:03:29 1.7 @@ -91,12 +91,7 @@ server_rec *s = r ? r->server : NULL; apr_pool_t *p = r ? r->pool : c->pool; -#ifdef USE_ITHREADS -pTHX; -modperl_interp_t *interp = NULL; -interp = modperl_interp_select(r, c, s); -aTHX = interp->perl; -#endif +MP_dINTERP_SELECT(r, c, s); args = newAV(); 1.8 +8 -0 modperl-2.0/src/modules/perl/modperl_interp.h Index: modperl_interp.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- modperl_interp.h 2000/08/14 03:10:45 1.7 +++ modperl_interp.h 2001/03/14 00:03:29 1.8 @@ -21,6 +21,12 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c, server_rec *s); +#define MP_dINTERP_SELECT(r, c, s) \ +pTHX; \ +modperl_interp_t *interp = NULL; \ +interp = modperl_interp_select(r, c, s); \ +aTHX = interp->perl + apr_status_t modperl_interp_pool_destroy(void *data); void modperl_interp_pool_add(modperl_interp_pool_t *mip, @@ -29,6 +35,8 @@ void modperl_interp_pool_remove(modperl_interp_pool_t *mip, modperl_interp_t *interp); +#else +#define MP_dINTERP_SELECT(r, c, s) dNOOP #endif #endif /* MODPERL_INTERP_H */
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 01/01/02 10:58:22 Modified:src/modules/perl modperl_filter.c Log: lay off the grass Revision ChangesPath 1.2 +5 -5 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_filter.c 2001/01/02 06:41:19 1.1 +++ modperl_filter.c 2001/01/02 18:58:21 1.2 @@ -141,16 +141,16 @@ /* unrolled AP_BRIGADE_FOREACH loop */ #define MP_FILTER_SENTINEL(filter) \ -AP_RING_SENTINEL(&(filter->bb)->list, ap_bucket, link) +AP_BRIGADE_SENTINEL(filter->bb) #define MP_FILTER_FIRST(filter) \ -AP_RING_FIRST(&(filter->bb)->list) +AP_BRIGADE_FIRST(filter->bb) #define MP_FILTER_NEXT(filter) \ -AP_RING_NEXT(filter->bucket, link) +AP_BUCKET_NEXT(filter->bucket) #define MP_FILTER_IS_EOS(filter) \ -(filter->bucket && AP_BUCKET_IS_EOS(filter->bucket)) +AP_BUCKET_IS_EOS(filter->bucket) MP_INLINE static int get_bucket(modperl_filter_t *filter) { @@ -312,7 +312,7 @@ } #define AP_BRIGADE_IS_EOS(bb) \ -AP_BUCKET_IS_EOS(AP_RING_FIRST(&(bb)->list)) +AP_BUCKET_IS_EOS(AP_BRIGADE_FIRST(bb)) apr_status_t modperl_output_filter_handler(ap_filter_t *f, ap_bucket_brigade *bb)
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c modperl_filter.h
dougm 01/01/01 22:41:19 Added: src/modules/perl modperl_filter.c modperl_filter.h Log: filter routines Revision ChangesPath 1.1 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === #include "mod_perl.h" /* simple buffer api */ MP_INLINE apr_status_t modperl_wbucket_pass(modperl_wbucket_t *wb, const char *buf, apr_ssize_t len) { ap_bucket_brigade *bb = ap_brigade_create(wb->pool); ap_bucket *bucket = ap_bucket_create_transient(buf, len); AP_BRIGADE_INSERT_TAIL(bb, bucket); return ap_pass_brigade(wb->filters, bb); } MP_INLINE apr_status_t modperl_wbucket_flush(modperl_wbucket_t *wb) { apr_status_t rv = APR_SUCCESS; if (wb->outcnt) { rv = modperl_wbucket_pass(wb, wb->outbuf, wb->outcnt); wb->outcnt = 0; } return rv; } MP_INLINE apr_status_t modperl_wbucket_write(modperl_wbucket_t *wb, const char *buf, apr_ssize_t *wlen) { apr_ssize_t len = *wlen; *wlen = 0; if ((len + wb->outcnt) > sizeof(wb->outbuf)) { apr_status_t rv; if ((rv = modperl_wbucket_flush(wb)) != APR_SUCCESS) { return rv; } } if (len >= sizeof(wb->outbuf)) { *wlen = len; return modperl_wbucket_pass(wb, buf, len); } else { memcpy(&wb->outbuf[wb->outcnt], buf, len); wb->outcnt += len; *wlen = len; return APR_SUCCESS; } } /* generic filter routines */ static char *filter_classes[] = { "Apache::InputFilter", "Apache::OutputFilter", }; modperl_filter_t *modperl_filter_new(ap_filter_t *f, ap_bucket_brigade *bb, modperl_filter_mode_e mode) { apr_pool_t *p = mode == MP_INPUT_FILTER_MODE ? f->c->pool : f->r->pool; modperl_filter_t *filter = apr_pcalloc(p, sizeof(*filter)); filter->mode = mode; filter->f = f; filter->bb = bb; filter->pool = p; filter->wbucket.pool = p; filter->wbucket.filters = f->next; filter->wbucket.outcnt = 0; MP_TRACE_f(MP_FUNC, "filter=0x%lx, mode=%s\n", (unsigned long)filter, mode == MP_OUTPUT_FILTER_MODE ? "output" : "input"); return filter; } int modperl_run_filter(modperl_filter_t *filter) { int status; modperl_handler_t *handler = ((modperl_filter_ctx_t *)filter->f->ctx)->handler; request_rec *r = filter->f->r; conn_rec*c = filter->f->c; server_rec *s = r ? r->server : NULL; apr_pool_t *p = r ? r->pool : c->pool; #ifdef USE_ITHREADS pTHX; modperl_interp_t *interp = NULL; interp = modperl_interp_select(r, c, s); handler->perl = aTHX = interp->perl; PERL_SET_CONTEXT(aTHX); #endif handler->args = newAV(); modperl_handler_make_args(aTHX_ handler->args, filter_classes[filter->mode], filter, NULL); if ((status = modperl_callback(aTHX_ handler, p)) != OK) { status = modperl_errsv(aTHX_ status, r, s); } SvREFCNT_dec((SV*)handler->args); handler->args = Nullav; MP_TRACE_f(MP_FUNC, "%s returned %d\n", handler->name, status); return status; } MP_INLINE modperl_filter_t *modperl_sv2filter(pTHX_ SV *sv) { modperl_filter_t *filter = NULL; if (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG)) { filter = (modperl_filter_t *)SvIV((SV*)SvRV(sv)); } return filter; } /* output filters */ MP_INLINE static apr_status_t send_eos(ap_filter_t *f) { ap_bucket_brigade *bb = ap_brigade_create(f->r->pool); ap_bucket *b = ap_bucket_create_eos(); AP_BRIGADE_INSERT_TAIL(bb, b); return ap_pass_brigade(f->next, bb); } /* unrolled AP_BRIGADE_FOREACH loop */ #define MP_FILTER_SENTINEL(filter) \ AP_RING_SENTINEL(&(filter->bb)->list, ap_bucket, link) #define MP_FILTER_FIRST(filter) \ AP_RING_FIRST(&(filter->bb)->list) #define MP_FILTER_NEXT(filter) \ AP_RING_NEXT(filter->bucket, link) #define MP_FILTER_IS_EOS(filter) \ (filter->bucket && AP_BUCKET_IS_EOS(filter->bucket)) MP_INLINE static int get_bucket(modperl_filter_t *filter) { if (!filter->bb) { return 0; } if (!filter->bucket) { filter->bucket = MP_FILTER_FIRST(filter); return 1; } else if (MP_FILTER_IS_EOS(filter)) { filter->eos = 1; return 1; } else if (filter->bucket != MP_FILTER_SENTINEL(filter))