Skip to content

Remove VLAs - #246

Merged
magicant merged 18 commits into
trunkfrom
remove-vlas
Jul 29, 2026
Merged

Remove VLAs#246
magicant merged 18 commits into
trunkfrom
remove-vlas

Conversation

@magicant

Copy link
Copy Markdown
Owner

Resolves #239

magicant added 18 commits July 29, 2026 23:13
Reuse a single xwcsbuf_T for the pattern components instead of
allocating a variable-length array on the stack in each iteration.

Part of #239.
The mbsargv array is now allocated on the heap with xmalloce. If execve
succeeds, the memory is discarded by exec; on the failure path it is
freed before returning.

Part of #239.
The extended_count workaround for empty variable-length arrays is no
longer needed now that the array is allocated on the heap.

Part of #239.
The extended_count workaround for empty variable-length arrays is no
longer needed now that the array is allocated on the heap.

Part of #239.
A single xstrbuf_T allocated outside the loop is now reused to build
the candidate pathnames.

Part of #239.
The count is clamped to a constant bound, so a fixed-size buffer
suffices. The bound is now a named constant.

Part of #239.
This prevents variable-length arrays from creeping back into the
codebase.

Closes #239.
@magicant magicant added this to the 2.62 milestone Jul 29, 2026
@magicant magicant self-assigned this Jul 29, 2026
@magicant
magicant merged commit db938d6 into trunk Jul 29, 2026
6 checks passed
@magicant
magicant deleted the remove-vlas branch July 29, 2026 15:52
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.

Remove variable-length arrays (VLAs) for C11 migration

1 participant