[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] apr_strnatcasecmp vs. strcasecmp

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-20 17:38:58 CET

Julian Foad wrote:
>
> Yes: in every call site, we just want to know whether two strings are
> equal (ignoring case). APR doesn't appear to document what a "natural
> order comparison" means, but looking at the implementation it appears to
> mean something like leading spaces are ignored and a run of digits is
> compared as a number rather than as characters. Without the semantics
> being documented I would not want to use apr_strnat[case]cmp().
>
> I think our one use of apr_strnatcasecmp is probably a mistake, or at
> least not a particularly good idea.

[[[
Stop using apr_strnatcasecmp().

* subversion/libsvn_subr/config.c
   Replace what is currently our only use of apr_strnatcasecmp() with
   strcasecmp() because the latter is more standard and the former is
   poorly defined and gives us no advantage here.
]]]

Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 18525)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -384,7 +384,7 @@
                           cfg->tmp_key->len);
        /* NOTE: ConfigParser's sections are case sensitive. */
        if (opt == NULL
- && apr_strnatcasecmp(section, SVN_CONFIG__DEFAULT_SECTION) != 0)
+ && strcasecmp(section, SVN_CONFIG__DEFAULT_SECTION) != 0)
          /* Options which aren't found in the requested section are
             also sought after in the default section. */
          opt = find_option(cfg, SVN_CONFIG__DEFAULT_SECTION, option, &sec);

Any objections to me making this change?

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 20 17:41:22 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.