On 10/12/2005 01:38 PM, Joe Orton wrote:

[..cut..]

> 
> 
> Yup, if using strchr on a const variable, the correct method to preserve 
> const-ness and avoid those warnings is:
> 
>   const char *foo;
> 
>   foo = ap_strchr_c(some_const_char_string, 'x');
> 
> note that 'c' would need to be const above too.

Thanks for that info. It took me a while to understand the macros
in util_debug.c / httpd.h (small letter macros OtherBill
just mentioned to dislike :-)).

I think I understand now what is going on and that in DEBUG mode
the strict checking whether const or not is enforced by wrapper
functions whereas in the non debug mode it is a simple macro that
maps things directly to the libc functions which do not do this strict
checking sometimes.
If I understand Jim correctly we should use ap_strchr / ap_strchr_c
throughout the code, but it is not done currently. Maybe I have a look
into this on a rainy day and exchange strchr against ap_strchr / ap_strchr_c
where appropriate :-).


Regards

Rüdiger



Reply via email to