Page MenuHomeFreeBSD

collate: Add support for equivalence classes and collating symbols
ClosedPublic

Authored by bnovkov on Apr 3 2025, 3:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 7, 1:12 PM
Unknown Object (File)
Tue, Dec 2, 9:36 AM
Unknown Object (File)
Fri, Nov 28, 4:43 AM
Unknown Object (File)
Tue, Nov 25, 2:29 PM
Unknown Object (File)
Wed, Nov 19, 4:08 AM
Unknown Object (File)
Nov 5 2025, 12:34 PM
Unknown Object (File)
Nov 5 2025, 12:59 AM
Unknown Object (File)
Nov 4 2025, 9:12 PM
Subscribers

Details

Summary

This change adds support for matching single and multi-character
equivalence classes and collating symbols, as specified
by POSIX1, section 9.3.5.

Sponsored by: Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/Libc

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63305
Build 60189: arc lint + arc unit

Event Timeline

markj added inline comments.
lib/libc/locale/collate.c
779

What exactly is the intent behind this casting? I guess we have to handle the case where l > slen, but slen is unsigned, so this looks strange.

983
985
lib/libc/locale/collate.h
139

What's the intended consumer of these symbols?

lib/libc/locale/Symbol.map needs to be updated for these symbols to be visible.

lib/libc/locale/collate.h
139

Sorry, ignore me, I see that the next revision adds some uses of these within libc.

bnovkov marked 4 inline comments as done.

Address @markj 's comments.

lib/libc/locale/collate.c
779

Hm, this does look strange, I am honestly not sure what this is supposed to accomplish.
I don't think l > slen will ever be true since mbrtowc will only inspect the next slen bytes.
I've removed the casts.

lib/libc/locale/collate.c
776

For consistency with other return statements.

811

Shouldn't this return dlen?

821
850

The same odd casting appears here.

865

Is IGNORE_EQUIVAL_CLASS == -1? It's not mentioned in the comment above.

972
bnovkov marked 4 inline comments as done.

Address @markj 's comments and fix a couple of style issues.

lib/libc/locale/collate.c
811

Hm, yeah, this doesn't seem to be the correct behavior if the chain is larger than dlen.
I've changed it to return dlen

865

It has a value of 1 and is defined at the top of collate.h.

markj added inline comments.
lib/libc/locale/collate.c
988
This revision is now accepted and ready to land.Apr 8 2025, 4:20 PM