1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-20 16:01:07 +01:00

C api: nix_export_std_string -> nix_observe_string

This commit is contained in:
José Luis Lafuente 2024-03-27 17:50:36 +01:00
parent 940ff6535c
commit d96b52bd8b
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
8 changed files with 92 additions and 76 deletions

View file

@ -56,26 +56,24 @@ void nix_store_free(Store * store)
delete store;
}
nix_err nix_store_get_uri(nix_c_context * context, Store * store, char * dest, unsigned int n)
nix_err nix_store_get_uri(nix_c_context * context, Store * store, void * callback, void * user_data)
{
if (context)
context->last_err_code = NIX_OK;
try {
auto res = store->ptr->getUri();
return nix_export_std_string(context, res, dest, n);
return call_nix_observe_string(res, callback, user_data);
}
NIXC_CATCH_ERRS
}
nix_err nix_store_get_version(nix_c_context * context, Store * store, char * dest, unsigned int n)
nix_err nix_store_get_version(nix_c_context * context, Store * store, void * callback, void * user_data)
{
if (context)
context->last_err_code = NIX_OK;
try {
auto res = store->ptr->getVersion();
if (!res)
res = "";
return nix_export_std_string(context, *res, dest, n);
return call_nix_observe_string(res.value_or(""), callback, user_data);
}
NIXC_CATCH_ERRS
}