apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Charmet <laurent.char...@atempo.com>
Subject [BUG?] apr_strnatcasecmp with space/blank
Date Thu, 16 Feb 2012 12:22:38 GMT
Hi all,

I have an issue with the function apr_strnatcasecmp(). Take a look at
gdb output:

5719                                if (apr_strnatcasecmp(type_str,
p_list[i].name) == 0) {
5720                                    service = (DEDUP_SERVICE_TYPE_T)
(p_list[i].type & 0xFF);
(gdb) p type_str
$4 = 0x62ca4d "Webserver"
(gdb) p p_list[i].name
$5 = 0x634ff0 "Web server"

So "Webserver" equal "Web server" ?!

I suspect that blank act as a separator and that "Web" equal "Web"

In the source there is this comment concerning "numeric string":

/* Compare, recognizing numeric string and ignoring case. */
APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b)
     return strnatcmp0(a, b, 1);

I hope it's a comment error because in the online documentation it's:

"Do a natural order comparison of two strings ignoring the case of the
strings. "

I just want a portable strcasecmp/stricmp


note: View in apr 1.4.2 and reproduce with 1.4.6

View raw message