diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-06-14 14:06:27 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-06-14 14:06:27 +0200 |
commit | 7954fe5d9627defcb5f73194c60d992df4137c10 (patch) | |
tree | e0262ad1b819672d3cbf06c26d3868988ed1a659 | |
parent | c1b8d9ca93ba2147202ae995f67f3752ff6eafcb (diff) | |
download | seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar.gz seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar.bz2 seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar.lz seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar.xz seitan-7954fe5d9627defcb5f73194c60d992df4137c10.tar.zst seitan-7954fe5d9627defcb5f73194c60d992df4137c10.zip |
cooker: fix initialization and variable type
-rw-r--r-- | cooker/emit.c | 2 | ||||
-rw-r--r-- | cooker/parse.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/cooker/emit.c b/cooker/emit.c index 1a7f3a9..8dc3e82 100644 --- a/cooker/emit.c +++ b/cooker/emit.c @@ -356,8 +356,6 @@ void emit_return(struct gluten_ctx *g, struct gluten_offset v, ret->desc = o; debug(" %i: OP_RETURN:", g->ip.offset); - debug(" \t val=(%s %d) errno=%d cont=%s", gluten_offset_name[v.type], - v.offset, error, cont ? "true" : "false"); if (++g->ip.offset > INST_MAX) die("Too many instructions"); diff --git a/cooker/parse.c b/cooker/parse.c index 46ca123..36c2649 100644 --- a/cooker/parse.c +++ b/cooker/parse.c @@ -98,7 +98,7 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) struct gluten_offset data = NULL_OFFSET, error = NULL_OFFSET; JSON_Object *obj = json_value_get_object(value); union value vv = NO_VALUE, ve = NO_VALUE; - const char *tag_error, *tag_value; + const char *tag_error = NULL, *tag_value = NULL; JSON_Value *jvalue; bool cont = false; char buf[BUFSIZ]; @@ -108,8 +108,8 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) jvalue = json_object_get_value(obj, "error"); if (json_value_get_type(jvalue) == JSONNumber) { - ve.v_u32 = json_value_get_number(jvalue); - error = emit_data(g, U32, sizeof(ve.v_u32), &ve); + ve.v_int = json_value_get_number(jvalue); + error = emit_data(g, INT, sizeof(ve.v_int), &ve); } else if ((tag_error = json_object_get_string(obj, "error"))) { error = gluten_get_tag(g, tag_error); } @@ -134,13 +134,13 @@ static void handle_return(struct gluten_ctx *g, JSON_Value *value) if (tag_value) n += snprintf(buf + n, BUFSIZ - n, "tag %s", tag_value); else - n += snprintf(buf + n, BUFSIZ - n, "%lu", vv.v_u64); + n += snprintf(buf + n, BUFSIZ - n, "%ld", vv.v_u64); n = snprintf(buf, BUFSIZ, " , error "); if (tag_error) n += snprintf(buf + n, BUFSIZ - n, "tag %s", tag_error); else - n += snprintf(buf + n, BUFSIZ - n, "%u", ve.v_u32); + n += snprintf(buf + n, BUFSIZ - n, "%d", ve.v_int); } else { snprintf(buf, BUFSIZ, " emit return: continue"); } |