Lines Matching refs:ctx

20 static size_t key_hash(const void *key, void *ctx __maybe_unused)
34 void *ctx __maybe_unused)
40 int expr__add_id(struct expr_parse_ctx *ctx, const char *id)
50 data_ptr->parent = ctx->parent;
52 ret = hashmap__set(&ctx->ids, id, data_ptr,
62 int expr__add_id_val(struct expr_parse_ctx *ctx, const char *id, double val)
74 ret = hashmap__set(&ctx->ids, id, data_ptr,
83 int expr__add_ref(struct expr_parse_ctx *ctx, struct metric_ref *ref)
120 ret = hashmap__set(&ctx->ids, name, data_ptr,
133 int expr__get_id(struct expr_parse_ctx *ctx, const char *id,
136 return hashmap__find(&ctx->ids, id, (void **)data) ? 0 : -1;
139 int expr__resolve_id(struct expr_parse_ctx *ctx, const char *id,
144 if (expr__get_id(ctx, id, datap) || !*datap) {
157 if (expr__parse(&data->val, ctx, data->ref.metric_expr, 1)) {
167 void expr__del_id(struct expr_parse_ctx *ctx, const char *id)
172 hashmap__delete(&ctx->ids, id,
178 void expr__ctx_init(struct expr_parse_ctx *ctx)
180 hashmap__init(&ctx->ids, key_hash, key_equal, NULL);
183 void expr__ctx_clear(struct expr_parse_ctx *ctx)
188 hashmap__for_each_entry((&ctx->ids), cur, bkt) {
192 hashmap__clear(&ctx->ids);
196 __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr,
220 ret = expr_parse(val, ctx, scanner);
228 int expr__parse(double *final_val, struct expr_parse_ctx *ctx,
231 return __expr__parse(final_val, ctx, expr, EXPR_PARSE, runtime) ? -1 : 0;
235 struct expr_parse_ctx *ctx, int runtime)
237 int ret = __expr__parse(NULL, ctx, expr, EXPR_OTHER, runtime);
240 expr__del_id(ctx, one);