Skip to content

feat(sigsafe): add thin C string byte iteration - #624

Merged
wan9chi merged 1 commit into
mainfrom
feat/sigsafe-cstr-bytes
Aug 10, 2026
Merged

feat(sigsafe): add thin C string byte iteration#624
wan9chi merged 1 commit into
mainfrom
feat/sigsafe-cstr-bytes

Conversation

@wan9chi

@wan9chi wan9chi commented Aug 10, 2026

Copy link
Copy Markdown
Member

Motivation

Thin C strings currently expose only a raw-pointer constructor and a whole-string count operation. Allocation-free callers that need to inspect bytes must duplicate unsafe NUL scanning, and callers that have already checked pointer nullability cannot preserve that proof.

This adds CStr<Thin>::bytes() and a reusable fused byte iterator, plus from_non_null so checked pointers stay non-null through construction. from_ptr remains as the unchecked raw-pointer adapter, and count reuses the byte iterator.


Stack created with GitHub Stacks CLIGive Feedback 💬

@wan9chi wan9chi changed the title feat/sigsafe cstr bytes feat(sigsafe): add thin C string byte iteration Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.78%  [ -4.75% ..  +6.06%]  overhead   +46.81%
dynamic/access             change  -0.50%  [ -3.67% ..  +3.45%]  overhead    +4.74%
dynamic/access-relative    change  -0.22%  [-10.66% ..  +4.73%]  overhead   +40.00%
static/launch              change  +0.40%  [ -4.44% ..  +6.63%]  overhead  +150.17%
static/access              change  +0.14%  [ -3.88% ..  +6.70%]  overhead  +716.14%
static/access-relative     change  -1.06%  [ -5.65% ..  +4.29%]  overhead  +874.76%

macos

dynamic/launch             change  -0.38%  [ -4.42% ..  +3.28%]  overhead  +224.87%
dynamic/access             change  +0.01%  [ -3.42% ..  +3.56%]  overhead    +6.00%
dynamic/access-relative    change  -0.32%  [ -6.42% ..  +7.66%]  overhead  +273.58%

windows

dynamic/launch             change  +0.38%  [ -4.47% ..  +5.60%]  overhead   +26.38%
dynamic/access             change  +0.54%  [ -1.40% ..  +6.73%]  overhead    +1.60%
dynamic/access-relative    change  +0.33%  [ -6.56% ..  +4.83%]  overhead    +1.42%

@wan9chi
wan9chi force-pushed the feat/sigsafe-cstr-bytes branch from c9367b4 to 4e0d3aa Compare August 10, 2026 04:50
@wan9chi
wan9chi marked this pull request as ready for review August 10, 2026 08:51
Co-authored-by: GPT-5 Codex <codex@openai.com>
@wan9chi
wan9chi force-pushed the feat/sigsafe-cstr-bytes branch from 4e0d3aa to d22b75a Compare August 10, 2026 08:55
@wan9chi
wan9chi merged commit a68a3bc into main Aug 10, 2026
19 checks passed
@wan9chi
wan9chi deleted the feat/sigsafe-cstr-bytes branch August 10, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant