blob: 09ae8e42a429cce62aff0a35ce73f4e961ec8345 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include <interp.h>
#include <interp_private.h>
#include <wasm_types.h>
#include <stddef.h>
#include <stdio.h>
static int op(FILE *const f, struct interp *const i)
{
varuint32 target_count, default_target;
if (varuint32_read(f, &target_count))
{
fprintf(stderr, "%s: varuint32_read target_count failed\n", __func__);
return -1;
}
for (varuint32 i = 0; i < target_count; i++)
{
varuint32 target_table;
if (varuint32_read(f, &target_table))
{
fprintf(stderr, "%s: varuint32_read target_table failed\n",
__func__);
return -1;
}
}
if (varuint32_read(f, &default_target))
{
fprintf(stderr, "%s: varuint32_read default_target failed\n", __func__);
return -1;
}
return 0;
}
int op_br_table(struct interp *const i)
{
return op(i->cfg.f, i);
}
int check_br_table(FILE *const f)
{
return op(f, NULL);
}
|