apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Malo ...@perlig.de>
Subject Re: [PATCH] locale independent apr_str_eq function
Date Sun, 03 Aug 2003 10:45:08 GMT
* Joe Orton wrote:

> On Sun, Aug 03, 2003 at 01:17:15AM +0200, André Malo wrote:
>> Well, I've started with a patch (attached). It works fine for me, but I'm
>> not sure with the naming at all. Any comments?
> 
> I understand the need for a strcasecmp replacement, but are the
> strcmp/!strcmp replacements just for consistency? On some platforms
> strcmp is an optimised asm inline so unless there's a good reason to
> tempt people away from strcmp I'd leave apr_streq/strneq out.

A good optimizer should do the same (perhaps I should do some benchmarks [1]).
Perhaps we should APR_INLINE the functions? But the advantages for a streq
interface would concern me more. The interface is better (more natural if you
wanna test strings for equality) and you don't take the overhead of the -1/1
decision.
If it's really slower than strcmp, we should at least

#define apr_streq(a,b) (!strcmp(a,b))

for the interface :)

> Adding the global arrays to apr_lib.h adds 512 bytes to every object
> file which includes that header, not sure that is a good idea, could
> result in noticeably bigger executables.

The linker should throw them away. But the alternative would be, however, to
put the new macros somewhere else. Where?

nd

[1] Hey, benchmarks during the build process would be cool -- and annoying
people ;-)

Mime
View raw message