diff options
Diffstat (limited to 'src/section/code.c')
| -rw-r--r-- | src/section/code.c | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/src/section/code.c b/src/section/code.c index 3d62143..7062359 100644 --- a/src/section/code.c +++ b/src/section/code.c @@ -20,6 +20,11 @@ #include <stdint.h> #include <string.h> +static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in) +{ + return -1; +} + static int check_body(FILE *const f, const unsigned long n) { unsigned long rem = n; @@ -148,6 +153,7 @@ static int check_local_group(FILE *const f, struct nw_interp *const i) return 0; } +#if 0 static int run(FILE *const f, struct nw_interp *const in) { varuint32 local_count; @@ -167,6 +173,7 @@ static int run(FILE *const f, struct nw_interp *const in) return 0; } +#endif static int push_frame(struct nw_interp *const i, const struct nw_frame *const src) @@ -202,7 +209,7 @@ static int check_function_body(FILE *const f, long *const out) LOG("%s: ftell(3) start: %s\n", __func__, strerror(errno)); return -1; } - else if (run(f, NULL)) + else if (run(f, 0, NULL)) { LOG("%s: check_local_groups failed\n", __func__); return -1; @@ -233,35 +240,6 @@ static int check_function_body(FILE *const f, long *const out) return 0; } -static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in) -{ - varuint32 count; - - if (varuint32_read(f, &count)) - { - LOG("%s: varuint32_read failed\n", __func__); - return -1; - } - - for (varuint32 i = 0; i < count; i++) - { - long start; - - if (check_function_body(f, &start)) - { - LOG("%s: check_function_body failed\n", __func__); - return -1; - } - else if (out && i == idx) - { - out->start = start; - return 0; - } - } - - return 0; -} - int section_code_check(const struct section *const s, struct nw_mod *const m, const unsigned long len) { @@ -280,7 +258,7 @@ int section_code_check(const struct section *const s, struct nw_mod *const m, LOG("%s: ftell(3): %s\n", __func__, strerror(errno)); return -1; } - else if (run(f, NULL)) + else if (run(f, 0, NULL)) { LOG("%s: run failed\n", __func__); return -1; @@ -307,6 +285,37 @@ int section_code_check(const struct section *const s, struct nw_mod *const m, return 0; } +#if 0 +static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in) +{ + varuint32 count; + + if (varuint32_read(f, &count)) + { + LOG("%s: varuint32_read failed\n", __func__); + return -1; + } + + for (varuint32 i = 0; i < count; i++) + { + long start; + + if (check_function_body(f, &start)) + { + LOG("%s: check_function_body failed\n", __func__); + return -1; + } + else if (out && i == idx) + { + out->start = start; + return 0; + } + } + + return 0; +} +#endif + int section_code(const struct section *const s, const struct nw_mod *const m, const varuint32 idx, struct section_code *const out) { @@ -328,5 +337,9 @@ int section_code(const struct section *const s, const struct nw_mod *const m, int section_code_push(FILE *const f, struct nw_interp *const i) { +#if 0 return run(f, i); +#else + return run(f, 0, i); +#endif } |
