![]() |
|
Message-ID: <20250629160302.GW1827@brightrain.aerifal.cx> Date: Sun, 29 Jun 2025 12:03:02 -0400 From: Rich Felker <dalias@...c.org> To: Nick Wellnhofer <wellnhofer@...um.de> Cc: musl@...ts.openwall.com Subject: Re: Paintcans for reverse iterating strings On Sun, Jun 29, 2025 at 05:39:14PM +0200, Nick Wellnhofer wrote: > On Jun 29, 2025, at 02:08, Rich Felker <dalias@...c.org> wrote: > > One thing we're going to need for LC_COLLATE in locales where > > second-level weights are applied in reverse order (diacritic marks > > later in the string weigh more than earlier ones) is the ability to > > traverse (& live transform to NFD) the input string in reverse. > > Assuming the context is strcoll and we're comparing two strings, > wouldn't it be possible to compare the strings in normal, forward > direction but instead of stopping at the first difference, comparing > all collation elements and returning the last difference (if any)? I believe you can do something like this for strcoll. Note that, normally, you don't even get to second level weights when using strcoll. Where you can't do it is strxfrm (transforming into a byte sequence that can be byte-by-byte compared). But this is a very useful observation you've made, in that the code should be factored such that reverse iteration need not be linked unless strxfrm/wcsxfrm is linked. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.