On Tue, Dec 29, 2009 at 1:30 AM, Ruediger Pluem <[email protected]> wrote:
> On 28.12.2009 18:28, Stefan Fritsch wrote:
>> On Monday 28 December 2009, Paul Querna wrote:
>>>> You describe the internal arg processing.  Keep in mind that fn
>>>> args aren't conditionally processed, they must be created before
>>>> being passed to the function.  If we can dodge that with a module
>>>> query 'is mod_foo at loglevel debug here?' then we can optimize
>>>> this considerably.
>>> Yes, see the implementation of the Noit Logger which I linked to,
>>>  it uses a Macro to check if a logger is enabled, so you don't have
>>>  the function arg prep/frame overhead if a logger isn't enabled.
>>>
>>
>> This would also make it possible to define the macro in a way that
>> disables debug logging at compile time, just as Bill wanted.
>>
>> However, the way reconoiter does it requires variadic macros
>> (http://en.wikipedia.org/wiki/Variadic_macro):
>>
>> #define APLOG(file, line, loglevel, server, ...) \
>> do { if (server->loglevel >= loglevel) \
>>      ap_log_error(file, line, loglevel, server, __VA_ARGS__) \
>> } while (0)
>>
>>
>> But variadic macros are only part of C99. Is it ok to drop support for
>> older, pre-C99 compilers in httpd?
>
> I think that would cancel support for some platforms (Netware ???).
> So IMHO no.

Pretty much everything else has a c99 compiler these days.  On
platforms that don't, you could easily fallback to this:

#ifdef HAVE_VA_ARGS
#define apL(stream, fmt, ...) if ((stream)->enabled) { \
   stream->log(fmt, __VA_ARGS__) \
}
#else
#define apL ap_stream_log
#endif

Where ap_strream_log is a normal function with a signature matching apL.

Yes, it means on netware, its slower, but no slower than what we do
today, and on most other platforms, it would be faster than what we do
today.

Reply via email to