Introduce the memmem libc string function.
memmem_implementation performs shared logic for strstr,
strcasestr, and memmem; essentially reconfiguring what was the
strstr_implementation to support length parameters.
Paths
| Differential D147822
[libc] Add memmem implementation ClosedPublic Authored by Caslyn on Apr 7 2023, 4:12 PM.
Details Summary Introduce the memmem libc string function. memmem_implementation performs shared logic for strstr,
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 7 2023, 4:12 PM Comment Actions Code looks good to me, I've added @gchatelet for his opinion on memmem being in memory_utils.
mcgrathr added inline comments.
Comment Actions
There's a bit of urgency to have this merged so we can begin some testing on Fuchsia, @gchatelet would appreciate your review as soon as you can. Comment Actions LGTM. We can look into any possible code-sharing with strstr_implementation later along with optimization.
This revision is now accepted and ready to land.Apr 11 2023, 12:20 PM Comment Actions Sorry for the lag, Monday was off in France and I missed the patch today.
Comment Actions
These are good suggestions and easy to apply right away before landing.
Caslyn marked 5 inline comments as done. Comment ActionsUpdates to memmem.cpp/memmem_test.cpp per review feedback Comment Actions Thanks for the quick response @gchatelet!
Closed by commit rG718729e9971d: [libc] Add memmem implementation (authored by Caslyn). · Explain WhyApr 11 2023, 2:11 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 511821 libc/config/baremetal/arm/entrypoints.txt
libc/config/darwin/arm/entrypoints.txt
libc/config/darwin/x86_64/entrypoints.txt
libc/config/gpu/entrypoints.txt
libc/config/linux/aarch64/entrypoints.txt
libc/config/linux/arm/entrypoints.txt
libc/config/linux/riscv64/entrypoints.txt
libc/config/linux/x86_64/entrypoints.txt
libc/config/windows/entrypoints.txt
libc/spec/gnu_ext.td
libc/src/string/CMakeLists.txt
libc/src/string/memmem.h
libc/src/string/memmem.cpp
libc/src/string/memory_utils/CMakeLists.txt
libc/src/string/memory_utils/memmem_implementations.h
libc/src/string/memory_utils/strstr_implementations.h
libc/src/string/strcasestr.cpp
libc/src/string/strstr.cpp
libc/test/src/string/CMakeLists.txt
libc/test/src/string/memmem_test.cpp
utils/bazel/llvm-project-overlay/libc/BUILD.bazel
|
nit: typo