Skip to content

Share one path component iterator across syscall/#210

Merged
jserv merged 1 commit into
sysprog21:mainfrom
henrybear327:refactor/path_walk
Jul 16, 2026
Merged

Share one path component iterator across syscall/#210
jserv merged 1 commit into
sysprog21:mainfrom
henrybear327:refactor/path_walk

Conversation

@henrybear327

@henrybear327 henrybear327 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

path.c and sidecar.c each carry a private copy of the same '/'-separated component walk, differing only in name and return type.

Promote path.c's path_next_component to external linkage and switch sidecar.c to it so the syscall layer keeps a single walker and future path predicates do not grow another copy.


Summary by cubic

Deduplicated path component iteration in the syscall layer by exporting path_next_component and switching sidecar.c to use it. This keeps one '/'-component walker and aligns behavior across callers with no functional changes.

  • Refactors
    • Exposed path_next_component(const char **pathp, const char **comp, size_t *len) in path.c and declared it in path.h with docs.
    • Removed sidecar_next_component and updated call sites in sidecar_translate_lookup_at to use the shared helper.
    • Preserved semantics: skips repeated slashes and returns false at end of path.

Written for commit 3451457. Summary will update on new commits.

Review in cubic

path.c and sidecar.c each carry a private copy of the same
'/'-separated component walk, differing only in name and return type.

Promote path.c's path_next_component to external linkage and switch
sidecar.c to it so the syscall layer keeps a single walker and future
path predicates do not grow another copy.
@henrybear327
henrybear327 requested a review from jserv July 16, 2026 16:05
cubic-dev-ai[bot]

This comment was marked as resolved.

@henrybear327 henrybear327 self-assigned this Jul 16, 2026
@jserv
jserv merged commit 3a4acdb into sysprog21:main Jul 16, 2026
10 checks passed
@jserv

jserv commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thank @henrybear327 for contributing!

@henrybear327
henrybear327 deleted the refactor/path_walk branch July 16, 2026 16:50
henrybear327 pushed a commit to henrybear327/elfuse that referenced this pull request Jul 17, 2026
Share one path component iterator across syscall/
henrybear327 pushed a commit to henrybear327/elfuse that referenced this pull request Jul 17, 2026
Share one path component iterator across syscall/
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.

2 participants