From 00614c5e6702db8ac3f18a9e193c7a8382f16e6b Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 14 Jun 2023 07:25:52 +0200 Subject: cooker: Support for read(), OP_STORE, field-based filters Signed-off-by: Stefano Brivio --- cooker/call.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cooker/call.c') diff --git a/cooker/call.c b/cooker/call.c index 4e9cb9c..c3f290c 100644 --- a/cooker/call.c +++ b/cooker/call.c @@ -100,6 +100,9 @@ static union value parse_field(struct gluten_ctx *g, struct arg *args, if (!dry_run) gluten_add_tag_post(g, tag_set, offset); + + if (f->flags & RBUF) + return v; } if ((tag_get = json_object_get_string(tmp2, "get"))) { @@ -199,13 +202,13 @@ static union value parse_field(struct gluten_ctx *g, struct arg *args, } break; case STRING: + if (dry_run) + break; + v.v_str = json_value_get_string(jvalue); if (strlen(v.v_str) + 1 > f->size) die(" string %s too long for field", v.v_str); - if (dry_run) - break; - emit_data_at(g, offset, f->type, &v); break; case STRUCT: @@ -327,7 +330,7 @@ static struct gluten_offset parse_arg(struct gluten_ctx *g, struct arg *args, } if (arg_needs_temp(&a->f, a->pos, jvalue, &top_level_tag, 0) || - multi_field) { + multi_field || (a->f.flags & RBUF)) { if (a->f.size) offset = gluten_rw_alloc(g, a->f.size); else -- cgit v1.2.3