httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <...@sunstarsys.com>
Subject Re: apreq2 style question
Date Thu, 24 Apr 2003 00:30:34 GMT
Stas Bekman <stas@stason.org> writes:

> Joe Schaefer wrote:
> > Stas Bekman <stas@stason.org> writes:
> >
> >>Any special reasons why APREQ_ENV, which is not a macro, is using
> >> upcase and macros apreq_env_* are using lowercase?
> > It just worked out that way.  I was making so many changes to
> > the apreq_env struct that I just started using the macros.
> > They saved me some editing time whenever I changed the struct.
> > The good news is that the macros are mapped to plain-old function
> >>calls, so they behave like functions.  You just can't
> > use the macro name as a function pointer.
> >
> >>Won't it be more intuitive to have things the other way around?
> > Perhaps, but other than the logging stuff, apreq_env.h shouldn't
> > be applicable to end-user code.  It's really only there to make
> > libapreq work within a given environment; and those are maintained
> > by *us*, in the httpd-apreq-2/env/ directory.
> 
> I wasn't questioning macros *usage*, 

OK.

> I was asking why do we have functions in upper case

We don't have any of those, do we?

> and macros in lower case. 

Only when they behave like functions.  For instance,
IMO apreq_strlen() is a good example of something that 
should remain a lower-cased macro.  It's supposed to
mimic strlen() but is both faster + more accurate
(it handles embedded \0's correctly).  Calling it
APREQ_STRLEN looks like crap, to me anyway.

> And suggesting that we may consider to have it the other
> way around: macros in upper case, functions in lowercase.

In regards to apreq_env.h, I would definitely support a patch
that dropped the apreq_env struct altogether, and promoted 
the lower-case macros to their corresponding function 
declarations. IOW something like

extern const char apreq_env_name[];
APREQ_DECLARE(apr_pool_t *) apreq_env_pool(void *ctx);
APREQ_DECLARE(void *) apreq_env_jar(void *ctx, void *jar);

[...]

APREQ_DECLARE_NONSTD(void) apreq_env_log( ... );


-- 
Joe Schaefer

Mime
View raw message