feat(libc): implement wcstok #2220
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2220"
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 reyani-dev on 2026-10-09T11:59:23Z.
What
Exports
wcstokon the guest's 16-bitwchar_t, next towcsspnand using the sameContainshelper. The behaviour follows FreeBSD's three-argumentwcstok(lib/libc/string/wcstok.c):*lastpoints past it;*lastbecomes NULL, both after the last token and when only delimiters remain;text == NULLit continues from*last, and returns NULL when that is NULL.Code units are compared one by one, so a surrogate pair is never split by a BMP delimiter.
Title: PPSA99420 PS5MC imports it from
libSceLibcInternal(resolved throughlibc.prx), per the #1578 audit. I haven't run the title.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release,
-DBUILD_TESTING=ON:guest_wide_string_tests, next towcsspn:u",,one,,two;three");*lastat the terminator (strtok_rstyle), or not skipping leading delimiters, each makeguest_wide_stringsfail.cmake --build build --target libs: the patchedlibc.prxexports8ngzWNZzFJU.tools/check_conventions.pypasses, andtools/pr_overlap.py --branchreports no overlap. It also merges cleanly with #1459, which touches the same files.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T11:59:46Z.
Progress report (
d70b899→c7818fd)📈 System libraries: 84.7% (+0.01%, +1 implemented functions)
✅ 1 implemented
wcstok_nid_postfixImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:10:24Z.
Review: APPROVED
Reviewed the full diff and reported checks. The implementation follows the three-argument tokenizer semantics: it skips leading delimiters, terminates at the first delimiter, saves the next position, and clears the continuation pointer at exhaustion. The tests cover repeated calls, alternate delimiter sets, delimiters-only input, and UTF-16 code units. The focused Windows report and all three relinker jobs pass; Conventions passes. Full Linux/Windows Build jobs are skipped on this PR, so the project Build workflow still needs to run before merge.
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-09T12:28:00Z.
Full Linux and Windows builds and tests for this head (
c7818fdd), using the project's Build workflow. I can't start the upstream manual run, so I ran the samebuild.ymlin my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into currentmain(d70b8998):ctest: 516/516 passedctest: 507/507 passedRun: https://github.com/AchrafReyani/AnyPS5/actions/runs/37927142712
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:10:20Z.
Same as #2167, for
wcstok.Pull request closed