At 04:10 AM 3/12/2005, André Malo wrote: >* Joe Schaefer wrote: > >> Any reason these str* overrides are still in httpd.h? >> Here's a patch to remove them from trunk, tested with >> both --enable-maintainer-mode and --enable-pool-debug set. > >-1. >These macros are type safety helpers, because some compilers are too picky >on const vs. non const parameters (and strchr is not declared consistently >across platforms).
That is NOT correct. There is no contract on the arguments or return value of, for example, strchr. This is a NOOP until you declare AP_DEBUG. Therefore, this is of no impact on release builds of httpd, and an impedement on as many compilers as it might help. All of the following are legitimate; char F = "foo", *f; const char B = "bar", *b; f = strchr(F, 'o'); b = strchr(F, 'o'); b = strchr(B, 'a'); The _invalid_ form is f = strchr(B, 'a'); but our macros FAIL to accomplish this. >One should use the ap_ variants throughout httpd and >these macros help to identify the bare variants without ap_ prefix. Absolutely! We have helpful ap_() helpers. Use them if they are what you intend! :) >At least these were the initial reasons for them. If they no longer apply, >forget my -1. The additional concern are platforms where strchr et al are not literally functions, but in fact they are macros, or intrinsic. Our wrappers are causing real headaches in complex compilations, such as perl+mod_perl+httpd+clib. Since I don't know what you mean, it's up to you to clarify your -1.