From 2334d80205afe5a1ce01cbaad002fe78770baf4e Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Sun, 23 Jul 2023 01:40:02 +0900 Subject: [PATCH] reduce code dup --- lib/insn.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/insn.c b/lib/insn.c index 7e1a515f..e62c8b22 100644 --- a/lib/insn.c +++ b/lib/insn.c @@ -288,9 +288,6 @@ get_functype(struct module *m, uint32_t typeidx, struct functype **ftp) return 0; } -static const struct resulttype rt_empty = { - .ntypes = 0, .is_static = true, CELLIDX_NONE}; - #define BYTE_AS_S33(b) ((int)(signed char)((b) + 0x80)) int @@ -307,8 +304,8 @@ get_functype_for_blocktype(struct module *m, int64_t blocktype, return EINVAL; } if (u8 == 0x40) { - *parameter = (void *)&rt_empty; /* unconst */ - *result = (void *)&rt_empty; /* unconst */ + *parameter = empty_rt; + *result = empty_rt; return 0; } if (is_valtype(u8)) { @@ -319,7 +316,7 @@ get_functype_for_blocktype(struct module *m, int64_t blocktype, if (ret != 0) { return ret; } - *parameter = (void *)&rt_empty; /* unconst */ + *parameter = empty_rt; *result = rt; return 0; }