Repository navigation
Closed
Labels
claimedAn agent or person has claimed this; check the claim comment before starting
Description
Unit
libobs/util/dstr-libc.c.h (272 lines) into rust/obs-util. It holds the libc-backed dstr helpers that stayed C when dstr.c was ported (#43):
wstrcmpi,wstrcmp_n,wstrcmpi_n,wstrstri,wcsdepaddstr_from_mbs,dstr_to_mbs,dstr_to_wcs,dstr_from_wcsdstr_to_upper,dstr_to_lowerdstr_printf,dstr_catf,dstr_vprintf,dstr_vcatf(C variadic)
Phase and position
Unit 2 of #1846. The rest of dstr is already in obs-util::dstr; this removes the last C part of it from the production build.
Dependencies and existing tests
- Stable Rust cannot define C-variadic functions or name a
va_list. As withbase-variadic.c.h,pipe-variadic.c.handprofiler-variadic.c.h, the four printf functions are copied verbatim intolibobs/util/dstr-variadic.c.h, compiled only in the hybrid (libobs.rust-variadicgroup). The C reference keeps compiling all ofdstr-libc.c.h. - The conversions call
os_mbs_to_utf8_ptr/os_utf8_to_wcs_ptrfromutil/platform-conversions.c.h(unit 1 of meta: 10 libobs units to move from C to Rust next #1846, not part of this unit). The Rust shim calls those symbols throughextern "C";wchar_to_utf8,dstr_free,dstr_resizeandbfreeare the Rust ports. towupper/towlowerare the C library's (locale-dependent), called fromobs-util::platform::crt, so case mapping matches C in any locale.test_dstrcovers onlydstr_to_upper/dstr_to_lower(ASCII) and the printf functions. A characterization testtest/cmocka/test_dstr_libc.clands first for the wide helpers and the conversions.
Characterized, not endorsed: dstr_to_mbs converts with os_mbs_to_utf8_ptr (the multibyte-to-UTF-8 direction), as the C does; dstr_from_mbs leaves capacity 0 with a non-NULL array.
Plan
One PR:
- Characterization:
test/cmocka/test_dstr_libc.c, registered intest/cmocka/build/test-graph.json. - RED:
obs-util::dstr_libcsafe core andffi::dstr_libcshim withtodo!(); Tier 1 tests intests/strings/dstr_libc.rs;dstr-libc.c.hmoves tolibobs.ported-util, printf copies todstr-variadic.c.hinlibobs.rust-variadic; export fragmentrust-exports.d/obs-util-dstr_libc.txt. - GREEN: the port; Tier 3 proptest parity against the oracle's
oracle_*dstr-libc (arbitrary wide strings, non-ASCII included); Tier 2 runstest_dstrandtest_dstr_libcagainst hybrid and C reference. - Tier 4 does not apply.
Metadata
Metadata
Assignees
Labels
claimedAn agent or person has claimed this; check the claim comment before starting
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 23, 2026
Claiming: util/dstr-libc.c port (unit 2 of #1846), one PR.
test_dstr_libc(committed on branchport/dstr-libc).dstr-variadic.c.h; draft PR right away.First PR: today.
util: Port dstr-libc to obs-util (GREEN)
zackees commentedon Oct 23, 2026
Coordinator note: two claims cover the same unit. #1855 (@zackees, claimed 2026-10-23 02:08 UTC) and #1858 / PR #1859 (@rdoupe, claimed 02:34 UTC) are both "unit 2 of #1846", the
util/dstr-libc.cport. Under coordination.md the earlier claim (#1855) has priority. #1859 already has a full port up, though. Please agree between you which one continues, and close the other issue as a duplicate, so no CI or review time goes to two ports.util: Port dstr-libc to obs-util (obs-rust#1857)