mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
Merge pull request #10910 from hercules-ci/c-api-nix_clear_err
C API: `nix_clear_err`
This commit is contained in:
commit
96a2ddab27
4 changed files with 37 additions and 4 deletions
|
@ -57,6 +57,12 @@ nix_err nix_set_err_msg(nix_c_context * context, nix_err err, const char * msg)
|
|||
return err;
|
||||
}
|
||||
|
||||
void nix_clear_err(nix_c_context * context)
|
||||
{
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
}
|
||||
|
||||
const char * nix_version_get()
|
||||
{
|
||||
return PACKAGE_VERSION;
|
||||
|
@ -106,7 +112,7 @@ const char * nix_err_msg(nix_c_context * context, const nix_c_context * read_con
|
|||
{
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
if (read_context->last_err) {
|
||||
if (read_context->last_err && read_context->last_err_code != NIX_OK) {
|
||||
if (n)
|
||||
*n = read_context->last_err->size();
|
||||
return read_context->last_err->c_str();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue