nix_api_store: add userdata param to nix_store_build

This commit is contained in:
Yorick van Pelt 2023-07-27 14:51:23 +02:00 committed by José Luis Lafuente
parent 1e583c4ebd
commit 1777e4a5bb
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
2 changed files with 8 additions and 3 deletions

View file

@ -93,7 +93,9 @@ StorePath *nix_store_parse_path(nix_c_context *context, Store *store,
}
nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
void (*iter)(const char *, const char *)) {
void *userdata,
void (*iter)(void *userdata, const char *,
const char *)) {
if (context)
context->last_err_code = NIX_OK;
try {
@ -107,7 +109,7 @@ nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
for (auto &[outputName, outputPath] :
store->ptr->queryDerivationOutputMap(path->path)) {
auto op = store->ptr->printStorePath(outputPath);
iter(outputName.c_str(), op.c_str());
iter(userdata, outputName.c_str(), op.c_str());
}
}
}

View file

@ -98,10 +98,13 @@ bool nix_store_is_valid_path(nix_c_context *context, Store *store,
* @param[out] context Optional, stores error information
* @param[in] store nix store reference
* @param[in] path Path to build
* @param[in] userdata data to pass to every callback invocation
* @param[in] cb called for every built output
*/
nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
void (*cb)(const char *outname, const char *out));
void *userdata,
void (*cb)(void *userdata, const char *outname,
const char *out));
/**
* @brief get the version of a nix store