Skip to content

nix_alloc_primop: args: fix constness and use all arguments - #16519

Open
yorickvP wants to merge 1 commit into
NixOS:masterfrom
yorickvP:fix-primop-api
Open

yorickvP wants to merge 1 commit into
NixOS:masterfrom
yorickvP:fix-primop-api

Conversation

@yorickvP

Copy link
Copy Markdown
Contributor

Motivation

The type for args in nix_alloc_primop was const char **, meaning a mutable array of const strings. We actually don't mutate the array, so it's fine to make it const instead. This makes the generated rust api less awkward.

Also, the first argument name was copied over instead of the correct one.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@yorickvP
yorickvP requested a review from edolstra as a code owner September 25, 2026 15:02
@github-actions github-actions Bot added the c api Nix as a C library with a stable interface label Sep 25, 2026
Comment on lines 127 to +128
for (size_t i = 0; args[i]; i++)
p->args.emplace_back(*args);
p->args.emplace_back(args[i]);

@xokdvium xokdvium Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, also this comes to mind. Why is there multiple sources of truth for the number of arguments (namely arity and the loop termination condition with there being a trailing NUL element in the array).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants