Page MenuHomeFreeBSD

collate: Add support for equivalence classes and collating symbols
ClosedPublic

Authored by bnovkov on Thu, Apr 3, 3:17 PM.
Tags
None
Referenced Files
F114967796: D49659.diff
Sat, Apr 19, 3:24 AM
Unknown Object (File)
Fri, Apr 11, 8:20 AM
Unknown Object (File)
Thu, Apr 10, 9:45 AM
Unknown Object (File)
Sat, Apr 5, 8:14 AM
Unknown Object (File)
Fri, Apr 4, 1:33 PM
Unknown Object (File)
Fri, Apr 4, 12:34 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 Not Applicable
Unit
Tests Not Applicable

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.Tue, Apr 8, 4:20 PM