1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

nix_api_expr: merge nix_parse_expr and nix_expr_eval, remove Expr

This commit is contained in:
Yorick van Pelt 2023-07-27 15:57:48 +02:00 committed by José Luis Lafuente
parent 1777e4a5bb
commit aa85f7d917
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
4 changed files with 11 additions and 66 deletions

View file

@ -39,27 +39,15 @@ nix_err nix_libexpr_init(nix_c_context *context) {
NIXC_CATCH_ERRS
}
Expr *nix_parse_expr_from_string(nix_c_context *context, State *state,
const char *expr, const char *path,
GCRef *ref) {
nix_err nix_expr_eval_from_string(nix_c_context *context, State *state,
const char *expr, const char *path,
Value *value) {
if (context)
context->last_err_code = NIX_OK;
try {
Expr *result = state->state.parseExprFromString(
nix::Expr *parsedExpr = state->state.parseExprFromString(
expr, state->state.rootPath(nix::CanonPath(path)));
if (ref)
ref->ptr = result;
return result;
}
NIXC_CATCH_ERRS_NULL
}
nix_err nix_expr_eval(nix_c_context *context, State *state, Expr *expr,
Value *value) {
if (context)
context->last_err_code = NIX_OK;
try {
state->state.eval((nix::Expr *)expr, *(nix::Value *)value);
state->state.eval(parsedExpr, *(nix::Value *)value);
}
NIXC_CATCH_ERRS
}