[PATCH 1/5] kernelbase/locale: Implement sortkey generation on official tables
Fabian Maurer
dark.shadow4 at web.de
Thu Apr 30 14:15:22 CDT 2020
Hello Zebediah,
> Could be, though I'd warn that attempts to reduce duplication (e.g. by
> introducing complicated macros) can often make code much less readable.
Sure, but in this case it should be very well worth it.
> Okay, I'm not sure I'm reading this macro right, but this is all
> internal to diacritic weights, right? If I understand, final weights
> which are 1 or 0 get stripped from the end of the sortkey, right? I
> think you could easily handle that by stripping weights after adding all
> of the diacritics, e.g. to use my previous example code,
>
> if (!(flags & NORM_IGNORENONSPACE))
> {
> for (i = 0; i < srclen; ++i)
> used += get_diacritic_weights(src[i], dst + used, dstlen - used);
>
> while (dst[used - 1] < 2)
> used--;
> }
Generally, yes. But it not only affects diacritics. And one needs to keep in
mind that the separator is also a 0 and must not be removed.
But maybe here the duplication is worth it?
Regards,
Fabian Maurer
More information about the wine-devel
mailing list