summaryrefslogtreecommitdiff
path: root/src/binary-reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader.cc')
-rw-r--r--src/binary-reader.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/binary-reader.cc b/src/binary-reader.cc
index 44d2dfbc..396d633c 100644
--- a/src/binary-reader.cc
+++ b/src/binary-reader.cc
@@ -466,13 +466,11 @@ static void write_indent(LoggingContext* ctx) {
LOGF_NOINDENT(__VA_ARGS__); \
} while (0)
-static void logging_on_error(BinaryReaderContext* ctx, const char* message) {
- LoggingContext* logging_ctx = static_cast<LoggingContext*>(ctx->user_data);
- if (logging_ctx->reader->on_error) {
- BinaryReaderContext new_ctx = *ctx;
- new_ctx.user_data = logging_ctx->reader->user_data;
- logging_ctx->reader->on_error(&new_ctx, message);
- }
+static Result logging_begin_section(BinaryReaderContext* context,
+ BinarySection section_type,
+ uint32_t size) {
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data);
+ FORWARD_CTX(begin_section, section_type, size);
}
static Result logging_begin_custom_section(BinaryReaderContext* context,
@@ -2031,7 +2029,8 @@ Result read_binary(const void* data,
WABT_ZERO_MEMORY(logging_reader);
logging_reader.user_data = &logging_context;
- logging_reader.on_error = logging_on_error;
+ logging_reader.on_error = reader->on_error;
+ logging_reader.begin_section = logging_begin_section;
logging_reader.begin_module = logging_begin_module;
logging_reader.end_module = logging_end_module;