1
0
Fork 0
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:
tomberek 2024-08-26 10:50:26 -04:00 committed by GitHub
commit 96a2ddab27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 4 deletions

View file

@ -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();