feat(libc): implement strsep and memccpy #1976
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1976"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T03:37:29Z.
What
strsepandmemccpywere not exported.strsepfollows BSD: it returns the token up to the first delimiter, overwrites the delimiter with NUL and advances the cursor past it, returns empty tokens, and sets the cursor to null after the last token. A null cursor returns null.memccpycopies up to and including the first byte equal to(unsigned char)c, returns the address after it in the destination, and returns null after copying allnbytes when the byte is absent.core/libs/prx/libc/src/StringExtensions.cpp: both functions.guest_stringstest: empty tokens, last token, null cursor, found and missing byte, a stop value above 255 and a zero count.Tested
Linux (CachyOS), GCC 16.2.1, Release.
guest_stringspasses.tools/check_conventions.py --base upstream/mainpasses.Not tested on Windows or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T04:36:28Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libc/src/StringExtensions.cppL75core/libs/prx/libc/src/StringExtensions.cppL75Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T06:06:31Z.
Review: APPROVED
Reviewed the full diff against current main.
strseppreserves empty fields and advances the cursor correctly;memccpycompares the stop value as an unsigned byte and returns the first byte after the copied delimiter. The added cases cover the key boundary behavior. I built and ran the exact head on Linux with GCC 12: guest_strings passed (1/1); conventions and diff checks pass. #1848 and #1972 add different functions in the same source file (#1972 depends on #1848), so there is no duplicate implementation. Note that open PR #2001 deletes GuestStrings.cpp; if that PR proceeds, it needs to preserve these and existing regression checks. Upstream Build/Conventions checks still have no results for this head.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:55:46Z.
Closing: no title is shown to reach
strsepormemccpyon main, and library functions go in when one does. Reopen with the title ID and the log line where it stops.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T10:03:54Z.
First Windows run, since the description says it wasn't tested on Windows.
Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Merged onto
mainb7218b3ctogether with nine other small libc/libkernel PRs: #1975, #1977, #1859, #1685, #1676, #1675, #1641, #1656, #1807.guest_stringspasses.🤖 Addressed by Claude Code
Pull request closed