This is an archive of the discontinued LLVM Phabricator instance.

[libc] Implement str{,n}casecmp
ClosedPublic

Authored by abrachet on Jan 8 2023, 1:47 PM.

Diff Detail

Event Timeline

abrachet created this revision.Jan 8 2023, 1:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2023, 1:47 PM
abrachet requested review of this revision.Jan 8 2023, 1:47 PM
sivachandra added inline comments.Jan 8 2023, 9:59 PM
libc/src/string/strcasecmp.cpp
19

This add a symbol level dependence on tolower. To avoid it, add a tolower implementation here: https://github.com/llvm/llvm-project/blob/main/libc/src/__support/ctype_utils.h.

libc/test/src/string/strcasecmp_test.cpp
29

Does comparing with the exact difference tightly couple this test with implementation details?

abrachet updated this revision to Diff 487886.Jan 10 2023, 10:55 AM
abrachet marked 2 inline comments as done.
abrachet added inline comments.
libc/test/src/string/strcasecmp_test.cpp
29

Does comparing with the exact difference tightly couple this test with implementation details?

Yes, FWIW I copied these verbatim from the strcmp tests. But I've changed the test here to use LT or GT relative to 0.

sivachandra accepted this revision.Jan 10 2023, 9:31 PM
This revision is now accepted and ready to land.Jan 10 2023, 9:31 PM
This revision was automatically updated to reflect the committed changes.
abrachet marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 9:39 PM