lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

collation improvements


From: Valeriy E. Ushakov
Subject: collation improvements
Date: Sat, 13 Feb 1999 19:57:52 +0300

Attached is a patch that tweaks collation support a bit.  I was going
to send this in before 3.13 is out, but plainly had no time.  This
patch should minimize the impact of broken locales on the rest of lout
code and improve sorting a bit.

The idea is that lout defines string ordering by testing for equality
and less-than.  Consider (hypothetic) function:

    int
    strcollcmp (char *a, char *b)
    {
        int order = strcoll (a, b);
        if (order == 0)  /* then disambiguate */
            order = strcmp (a, b);
        return order;
    }

The above function has an important property that 

    strcollcmp (a, b) == 0   <=>   strcmp (a, b) == 0

So StringEqual used throughout lout code is simply strcmp even for
COLLATE=1 case.  This is both faster and safer.  (I actually get back
to review that no-brain collation support that I submitted back then,
when Lout complained on "+-" being already defined in the previous
line that defined "-+"; the two being equal strcoll-wise under the
locale installed on that box).

I also rewrote sorting to use strxfrm for speed.

I'd appreciate if you can test it and report me any problems you might
encounter.


PS: The patch also adds missing debugcond6 to externs.h for the
    DEBUG=0 case.

SY, Uwe
-- 
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen

Attachment: lout-3.13-collation.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]