httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject Re: [PATCH] Start of command handlers patch
Date Mon, 12 Jun 2000 11:47:22 GMT
On Sun, 11 Jun 2000, Ben Laurie wrote:

> Just to make sure everyone knows what I had in mind, here's the start of
> the patch. BTW, if we're all agreed this is worth doing, I'd really like
> to commit it part-done and share the load of converting every single
> command handler!

ok... i kind of don't see the point -- 'cause it just makes the compile
work without really providing type safety.

we could do something we've done before -- set things up to give us
warnings on the majority of platforms we develop on, but have no warnings
on other platforms.

specifically we could use a c9x or gcc feature -- the ability to
initialise a specific member of a union.

change:
    const char *(*func) ();     /* Function invoked */

to:

    union {
	const char *(take1) (cmd_parms *cmd, void *mconfig, const char *arg1);
	const char *(take2) (cmd_parms *cmd, void *mconfig, const char *arg1, const char *arg2);
	...
    } ufunc;

and add:

#define INIT_TAKE1(name, func, cmd_data, req_override, errmsg) \
    { name, { .take1 = func }, cmd_data, req_override, TAKE1, errmsg }
#define INIT_TAKE2(name, func, cmd_data, req_override, errmsg) \
    { name, { .take2 = func }, cmd_data, req_override, TAKE2, errmsg }
...

at least i think that's the right syntax.

and if the compiler doesn't support that syntax we just cast in the
INIT_xxx() macros.

-dean


Mime
View raw message