From 1777e4a5bb40a98c1c70b2baa4f5485373d46564 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Thu, 27 Jul 2023 14:51:23 +0200 Subject: [PATCH] nix_api_store: add userdata param to nix_store_build --- src/libstore/nix_api_store.cc | 6 ++++-- src/libstore/nix_api_store.h | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libstore/nix_api_store.cc b/src/libstore/nix_api_store.cc index 312e5f2a8..c81ad49ee 100644 --- a/src/libstore/nix_api_store.cc +++ b/src/libstore/nix_api_store.cc @@ -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()); } } } diff --git a/src/libstore/nix_api_store.h b/src/libstore/nix_api_store.h index ba7b9ec5e..6157faa82 100644 --- a/src/libstore/nix_api_store.h +++ b/src/libstore/nix_api_store.h @@ -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