From: chris mikkelson Date: Tue, 9 Mar 2010 01:01:36 +0000 (-0600) Subject: Make multipart module's next module type a module parameter. X-Git-Url: https://git.mikk.net/?a=commitdiff_plain;h=a92ec3595ca22977782b17797255d18961e4702e;p=liburl Make multipart module's next module type a module parameter. --- diff --git a/multipart.c b/multipart.c index 074e9c8..83e8f26 100644 --- a/multipart.c +++ b/multipart.c @@ -9,6 +9,9 @@ /* needs to be published for other callers */ #define MULTIPART_BOUNDARY 1 +#define MULTIPART_MODULE_NEXTMOD 1 + +static msgproc_module *nextmod; struct multipart_state { char *boundary; @@ -28,6 +31,13 @@ multipart_start(msgproc *m) msgproc_setpriv(m, (void*)mps); } +static void +setnextmod(int type, void *data, size_t size) +{ + if (type != MULTIPART_MODULE_NEXTMOD) return; + nextmod = (msgproc_module *)data; +} + static void setboundary(msgproc *m, int type, void *data, size_t size) { @@ -158,7 +168,7 @@ multipart_finish(msgproc *m) msgproc_module msgproc_multipart = { MSGPROC_MULTIPART, /* type */ NULL, /* module init */ - NULL, /* set module parameter */ + setnextmod, /* set module parameter */ multipart_start, /* start module instance */ setboundary, /* set module instance parameter */ multipart_process, /* process data */