It solves a specific issue that in server apps, conforming to an ASCII
derived spec, when not running on the anticipated code page/language
context will normalize comparisons in unexpected ways.  E.g. I == i, but if
the spec is ASCII, then I != ī etc.

It was presented as an optimization but my response can be generalized as
'fix your clib, then!'  But it called out an actual issue that many authors
need to be attentive to.
On Nov 23, 2015 14:30, "Christopher Schultz" <ch...@christopherschultz.net>
wrote:

> All,
>
> Can I ask a stupid question? What does the proposed apr_str[n]casecmp
> function do that POSIX.1 strcasecmp doesn't do?
>
> I guess that's two questions, either of which may be stupid.
>
> Is this is a performance issue? Supporting non-ASCII is a waste of time?
>
> Thanks,
> -chris
>
> On 11/23/15 11:58 AM, William A Rowe Jr wrote:
> > Sorting ASCII tokens still seems valuable for various sorts of
> > optimizations,
> > and it really doesn't carry a significant cpu cost to do so...
> >
> > I'd rather we kept the <0 ! >0 behavior.
> >
> > On Mon, Nov 23, 2015 at 9:44 AM, Jim Jagielski <j...@jagunet.com
> > <mailto:j...@jagunet.com>> wrote:
> >
> >     Should we then adjust docs and usage to remove the "greater/less
> than"
> >     criteria and just say equal strings return 0 and non 0 means that
> >     the strings don't compare/are different?
> >
> >     > On Nov 23, 2015, at 10:19 AM, William A Rowe Jr
> >     <wr...@rowe-clan.net <mailto:wr...@rowe-clan.net>> wrote:
> >     >
> >     > On Mon, Nov 23, 2015 at 2:11 AM, Branko Čibej <br...@apache.org
> >     <mailto:br...@apache.org>> wrote:
> >     >
> >     > +1 to apr_casecmpstr[n]() with a big fat warning in the docstring
> that
> >     > it works for ASCII only.
> >     >
> >     > Well, it 'works' (does not segfault, does not case fold them) for
> >     high bit
> >     > characters, but sorts them in a potentially meaningless way.  The
> >     Current
> >     > implementation has already drifted; the currently accepted flavor
> >     looks like;
> >     >
> >     > 2441
> >     > /**
> >     >
> >     > 2442
> >     >  * Known-fast version of strcasecmp(): ASCII case-folding, POSIX
> >     compliant
> >     >
> >     > 2443
> >     >  * @param s1 The 1st string to compare
> >     >
> >     > 2444
> >     >  * @param s2 The 2nd string to compare
> >     >
> >     > 2445
> >     >  * @return integer greater than, equal to, or less than 0,
> >     depending on
> >     >
> >     > 2446
> >     >  *         if s1 is lexicographically greater than, equal to, or
> less
> >     >
> >     > 2447
> >     >  *         than s2 ignoring case.
> >     >
> >     > 2448
> >     >  */
> >     >
> >     > 2449
> >     > AP_DECLARE(int) ap_casecmpstr(const char *s1, const char *s2);
> >     >
> >     > 2450
> >     > 2451
> >     > /**
> >     >
> >     > 2452
> >     >  * Known-fast version of strncasecmp(): ASCII case-folding, POSIX
> >     compliant
> >     >
> >     > 2453
> >     >  * @param s1 The 1st string to compare
> >     >
> >     > 2454
> >     >  * @param s2 The 2nd string to compare
> >     >
> >     > 2455
> >     >  * @param n  Maximum number of characters in the strings to compare
> >     >
> >     > 2456
> >     >  * @return integer greater than, equal to, or less than 0,
> >     depending on
> >     >
> >     > 2457
> >     >  *         if s1 is lexicographically greater than, equal to, or
> less
> >     >
> >     > 2458
> >     >  *         than s2 ignoring case.
> >     >
> >     > 2459
> >     >  */
> >     >
> >     > 2460
> >     > AP_DECLARE(int) ap_casecmpstrn(const char *s1, const char *s2,
> >     apr_size_t n);
> >     >
> >     >
> >     >
> >     > and is implemented here;
> >     >
> >     >
> >
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?view=markup&pathrev=1715736#l3175
> >     >
> >     >
> >     >
> >
> >
>

Reply via email to