Skip to content

Commit

Permalink
reduce code dup
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jul 22, 2023
1 parent 7e732f2 commit 2334d80
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/insn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 2334d80

Please sign in to comment.