1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

C API: update docs based on PR feedback

This commit is contained in:
José Luis Lafuente 2024-02-25 14:20:57 +01:00 committed by José Luis Lafuente
parent 7c602d9f01
commit c49b88b066
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
7 changed files with 18 additions and 12 deletions

View file

@ -18,7 +18,7 @@
*
* nix_gc_decref(NULL, value);
* nix_state_free(state);
* nix_store_unref(store);
* nix_store_free(store);
* return 0;
* }
* @endcode

View file

@ -269,6 +269,11 @@ const char * nix_get_attr_name_byidx(nix_c_context * context, const Value * valu
/**@}*/
/** @name Initializers
*
* Values are typically "returned" by initializing already allocated memory that serves as the return value.
* For this reason, the construction of values is not tied their allocation.
* Nix is a language with immutable values. Respect this property by only initializing Values once; and only initialize
* Values that are meant to be initialized by you. Failing to adhere to these rules may lead to undefined behavior.
*/
/**@{*/
/** @brief Set boolean value

View file

@ -50,7 +50,7 @@ Store * nix_store_open(nix_c_context * context, const char * uri, const char ***
NIXC_CATCH_ERRS_NULL
}
void nix_store_unref(Store * store)
void nix_store_free(Store * store)
{
delete store;
}

View file

@ -48,23 +48,24 @@ nix_err nix_init_plugins(nix_c_context * context);
/**
* @brief Open a nix store
* Store instances may share state and resources behind the scenes.
* @param[out] context Optional, stores error information
* @param[in] uri URI of the nix store, copied
* @param[in] params optional, array of key-value pairs, {{"endpoint",
* "https://s3.local"}}
* @return ref-counted Store pointer, NULL in case of errors
* @see nix_store_unref
* @return a Store pointer, NULL in case of errors
* @see nix_store_free
*/
Store * nix_store_open(nix_c_context *, const char * uri, const char *** params);
/**
* @brief Unref a nix store
* @brief Deallocate a nix store and free any resources if not also held by other Store instances.
*
* Does not fail.
* It'll be closed and deallocated when all references are gone.
* @param[in] builder the store to unref
*
* @param[in] store the store to free
*/
void nix_store_unref(Store * store);
void nix_store_free(Store * store);
/**
* @brief get the URI of a nix store