diff --git a/src/libutil/nix_api_util.cc b/src/libutil/nix_api_util.cc index 4f892637c..a5b575a3c 100644 --- a/src/libutil/nix_api_util.cc +++ b/src/libutil/nix_api_util.cc @@ -127,10 +127,7 @@ nix_err nix_err_info_msg(nix_c_context *context, n); } -nix_err nix_err_code(nix_c_context *context, - const nix_c_context *read_context) { - if (context) - context->last_err_code = NIX_OK; +nix_err nix_err_code(const nix_c_context *read_context) { return read_context->last_err_code; } diff --git a/src/libutil/nix_api_util.h b/src/libutil/nix_api_util.h index f626f2ccb..63854e4d8 100644 --- a/src/libutil/nix_api_util.h +++ b/src/libutil/nix_api_util.h @@ -253,12 +253,12 @@ nix_err nix_err_name(nix_c_context *context, const nix_c_context *read_context, * * Equivalent to reading the first field of the context. * - * @param[out] context optional, the context to store errors in if this function - * fails + * Does not fail + * * @param[in] read_context the context to retrieve the error message from * @return most recent error code stored in the context. */ -nix_err nix_err_code(nix_c_context *context, const nix_c_context *read_context); +nix_err nix_err_code(const nix_c_context *read_context); /** * @}