diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binary-reader-objdump.c | 10 | ||||
-rw-r--r-- | src/binary-reader.c | 34 | ||||
-rw-r--r-- | src/binary-reader.h | 10 | ||||
-rw-r--r-- | src/binary-writer.c | 12 | ||||
-rw-r--r-- | src/binary.h | 2 |
5 files changed, 34 insertions, 34 deletions
diff --git a/src/binary-reader-objdump.c b/src/binary-reader-objdump.c index 993fbbd6..3da697fd 100644 --- a/src/binary-reader-objdump.c +++ b/src/binary-reader-objdump.c @@ -97,11 +97,11 @@ static WasmResult begin_section(Context* ctx, return WASM_OK; } -static WasmResult begin_user_section(WasmBinaryReaderContext* ctx, - uint32_t size, - WasmStringSlice section_name) { +static WasmResult begin_custom_section(WasmBinaryReaderContext* ctx, + uint32_t size, + WasmStringSlice section_name) { Context* context = ctx->user_data; - if (begin_section(context, "USER", ctx->offset, size)) + if (begin_section(context, "CUSTOM", ctx->offset, size)) return WASM_ERROR; if (context->options->mode == WASM_DUMP_DETAILS) printf(" - name: \"" PRIstringslice "\"\n", WASM_PRINTF_STRING_SLICE_ARG(section_name)); @@ -583,7 +583,7 @@ static WasmBinaryReader s_binary_reader = { .on_error = on_error, // User section - .begin_user_section = begin_user_section, + .begin_custom_section = begin_custom_section, // Signature section .begin_signature_section = begin_signature_section, diff --git a/src/binary-reader.c b/src/binary-reader.c index d102ec08..613b2feb 100644 --- a/src/binary-reader.c +++ b/src/binary-reader.c @@ -410,10 +410,10 @@ static uint32_t num_total_globals(Context* ctx) { return ctx->num_global_imports + ctx->num_globals; } -static void handle_user_section(Context* ctx, - WasmStringSlice* section_name, - uint32_t section_size) { - CALLBACK_CTX(begin_user_section, section_size, *section_name); +static void handle_custom_section(Context* ctx, + WasmStringSlice* section_name, + uint32_t section_size) { + CALLBACK_CTX(begin_custom_section, section_size, *section_name); if (ctx->options->read_debug_names && ctx->name_section_ok && strncmp(section_name->start, WASM_BINARY_SECTION_NAME, section_name->length) == 0) { @@ -440,7 +440,7 @@ static void handle_user_section(Context* ctx, } CALLBACK0(end_names_section); } - CALLBACK_CTX0(end_user_section); + CALLBACK_CTX0(end_custom_section); } static WasmBool skip_until_section(Context* ctx, @@ -464,10 +464,10 @@ static WasmBool skip_until_section(Context* ctx, if (ctx->section_end > ctx->data_size) RAISE_ERROR("invalid section size: extends past end"); - if (section_code == WASM_BINARY_SECTION_USER) { + if (section_code == WASM_BINARY_SECTION_CUSTOM) { WasmStringSlice section_name; in_str(ctx, §ion_name, "section name"); - handle_user_section(ctx, §ion_name, *section_size); + handle_custom_section(ctx, §ion_name, *section_size); ctx->offset = ctx->section_end; return skip_until_section(ctx, expected_code, section_size); } else { @@ -539,14 +539,14 @@ static void logging_on_error(WasmBinaryReaderContext* ctx, } } -static WasmResult logging_begin_user_section(WasmBinaryReaderContext* context, - uint32_t size, - WasmStringSlice section_name) { +static WasmResult logging_begin_custom_section(WasmBinaryReaderContext* context, + uint32_t size, + WasmStringSlice section_name) { LoggingContext* ctx = context->user_data; - LOGF("begin_user_section: '" PRIstringslice "' size=%d\n", + LOGF("begin_custom_section: '" PRIstringslice "' size=%d\n", WASM_PRINTF_STRING_SLICE_ARG(section_name), size); indent(ctx); - FORWARD_CTX(begin_user_section, size, section_name); + FORWARD_CTX(begin_custom_section, size, section_name); } #define LOGGING_BEGIN(name) \ @@ -604,7 +604,7 @@ static WasmResult logging_begin_user_section(WasmBinaryReaderContext* context, LOGGING_UINT32(begin_module) LOGGING0(end_module) -LOGGING_END(user_section) +LOGGING_END(custom_section) LOGGING_BEGIN(signature_section) LOGGING_UINT32(on_signature_count) LOGGING_END(signature_section) @@ -1024,8 +1024,8 @@ static WasmBinaryReader s_logging_binary_reader = { .begin_module = logging_begin_module, .end_module = logging_end_module, - .begin_user_section = logging_begin_user_section, - .end_user_section = logging_end_user_section, + .begin_custom_section = logging_begin_custom_section, + .end_custom_section = logging_end_custom_section, .begin_signature_section = logging_begin_signature_section, .on_signature_count = logging_on_signature_count, @@ -2060,8 +2060,8 @@ WasmResult wasm_read_binary(WasmAllocator* allocator, CALLBACK_CTX0(end_data_section); } - /* Handle supported unnamed sections at the end. */ - skip_until_section(ctx, WASM_BINARY_SECTION_USER, §ion_size); + /* Handle supported custom sections at the end. */ + skip_until_section(ctx, WASM_BINARY_SECTION_CUSTOM, §ion_size); CALLBACK0(end_module); destroy_context(allocator, ctx); diff --git a/src/binary-reader.h b/src/binary-reader.h index bf928d61..e51c0f01 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -49,11 +49,11 @@ typedef struct WasmBinaryReader { WasmResult (*begin_module)(uint32_t version, void* user_data); WasmResult (*end_module)(void* user_data); - /* user section */ - WasmResult (*begin_user_section)(WasmBinaryReaderContext* ctx, - uint32_t size, - WasmStringSlice section_name); - WasmResult (*end_user_section)(WasmBinaryReaderContext* ctx); + /* custom section */ + WasmResult (*begin_custom_section)(WasmBinaryReaderContext* ctx, + uint32_t size, + WasmStringSlice section_name); + WasmResult (*end_custom_section)(WasmBinaryReaderContext* ctx); /* signatures section */ /* TODO(binji): rename to "type" section */ diff --git a/src/binary-writer.c b/src/binary-writer.c index d64dc734..c71ea75a 100644 --- a/src/binary-writer.c +++ b/src/binary-writer.c @@ -236,19 +236,19 @@ static void begin_known_section(Context* ctx, write_u32_leb128_space(ctx, leb_size_guess, "section size (guess)"); } -static void begin_user_section(Context* ctx, - const char* name, - size_t leb_size_guess) { +static void begin_custom_section(Context* ctx, + const char* name, + size_t leb_size_guess) { assert(ctx->last_section_leb_size_guess == 0); char desc[100]; wasm_snprintf(desc, sizeof(desc), "section \"%s\"", name); write_header(ctx, desc, PRINT_HEADER_NO_INDEX); - wasm_write_u8(&ctx->stream, WASM_BINARY_SECTION_USER, "user section code"); + wasm_write_u8(&ctx->stream, WASM_BINARY_SECTION_CUSTOM, "custom section code"); ctx->last_section_leb_size_guess = leb_size_guess; ctx->last_section_offset = write_u32_leb128_space(ctx, leb_size_guess, "section size (guess)"); write_str(&ctx->stream, name, strlen(name), WASM_PRINT_CHARS, - "user section name"); + "custom section name"); } static void end_section(Context* ctx) { @@ -788,7 +788,7 @@ static void write_module(Context* ctx, const WasmModule* module) { WASM_ZERO_MEMORY(index_to_name); char desc[100]; - begin_user_section(ctx, WASM_BINARY_SECTION_NAME, leb_size_guess); + begin_custom_section(ctx, WASM_BINARY_SECTION_NAME, leb_size_guess); write_u32_leb128(&ctx->stream, module->funcs.size, "num functions"); for (i = 0; i < module->funcs.size; ++i) { const WasmFunc* func = module->funcs.data[i]; diff --git a/src/binary.h b/src/binary.h index 3d051837..632cd3e0 100644 --- a/src/binary.h +++ b/src/binary.h @@ -24,7 +24,7 @@ #define WASM_BINARY_SECTION_NAME "name" #define WASM_FOREACH_BINARY_SECTION(V) \ - V(USER, 0) \ + V(CUSTOM, 0) \ V(TYPE, 1) \ V(IMPORT, 2) \ V(FUNCTION, 3) \ |