You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
init: convert ArgParse/MachoCache/PdbCache to compound-literal macros
These three were the only non-I/O inits still doing function-shaped
construction. Their bodies were trivial -- field assigns plus a
nested VecInit -- so they fit the same compound-literal pattern the
rest of the codebase uses (StrInit / VecInit / MapInit / HttpRequestInit).
`ArgParseInit` keeps the `(name, about[, alloc])` shape and now
expands to `((ArgParse){.alloc = ALLOCATOR_OF(...), .name = ...,
.about = ..., .specs = VecInit_1(...)})`. The macro parameters are
renamed `prog_name` / `prog_about` so they don't shadow the
`.name` / `.about` field designators when the preprocessor substitutes
the args inside the compound literal -- a portability requirement,
not a stylistic one. The NULL-`name` runtime guard is dropped:
`ALLOCATOR_OF` already enforces a typed allocator at compile time
and callers pass string literals for `name`.
`MachoCacheInit` / `PdbCacheInit` shift from
`bool fn(T *out, Allocator *)` to return-by-value compound literal.
The two Backtrace callsites are rewritten to gate on `alloc` first
(`bool ok = alloc != NULL; T c = ok ? Init(alloc) : (T){0};`) and
the test callers drop the `&out` argument. The bool return was
already effectively redundant: the only failure path was a NULL
out-pointer that never occurred in any caller.
Linux 104/104 + Mac 99/99 green.
0 commit comments