mirror of
https://github.com/NixOS/nix
synced 2025-06-30 11:43:15 +02:00
C API: Use nix_get_string_callback
typedef
This commit is contained in:
parent
76444a3958
commit
774e7213e8
6 changed files with 19 additions and 62 deletions
|
@ -56,11 +56,7 @@ void nix_store_free(Store * store)
|
|||
delete store;
|
||||
}
|
||||
|
||||
nix_err nix_store_get_uri(
|
||||
nix_c_context * context,
|
||||
Store * store,
|
||||
void (*callback)(const char * start, unsigned int n, void * user_data),
|
||||
void * user_data)
|
||||
nix_err nix_store_get_uri(nix_c_context * context, Store * store, nix_get_string_callback callback, void * user_data)
|
||||
{
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
|
@ -71,11 +67,8 @@ nix_err nix_store_get_uri(
|
|||
NIXC_CATCH_ERRS
|
||||
}
|
||||
|
||||
nix_err nix_store_get_version(
|
||||
nix_c_context * context,
|
||||
Store * store,
|
||||
void (*callback)(const char * start, unsigned int n, void * user_data),
|
||||
void * user_data)
|
||||
nix_err
|
||||
nix_store_get_version(nix_c_context * context, Store * store, nix_get_string_callback callback, void * user_data)
|
||||
{
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
|
@ -136,13 +129,10 @@ nix_err nix_store_realise(
|
|||
NIXC_CATCH_ERRS
|
||||
}
|
||||
|
||||
void nix_store_path_name(
|
||||
const StorePath * store_path,
|
||||
void (*callback)(const char * start, unsigned int n, void * user_data),
|
||||
void * user_data)
|
||||
void nix_store_path_name(const StorePath * store_path, nix_get_string_callback callback, void * user_data)
|
||||
{
|
||||
std::string_view name = store_path->path.name();
|
||||
((nix_get_string_callback) callback)(name.data(), name.size(), user_data);
|
||||
callback(name.data(), name.size(), user_data);
|
||||
}
|
||||
|
||||
void nix_store_path_free(StorePath * sp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue