From 9116c697f845e7ca215628029800c36f7dfbfaee Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 15 Jan 2010 18:12:28 -0800 Subject: upb_parser -> upb_decoder --- benchmarks/parsetostruct.upb_table.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'benchmarks/parsetostruct.upb_table.c') diff --git a/benchmarks/parsetostruct.upb_table.c b/benchmarks/parsetostruct.upb_table.c index 7614b30..72799e4 100644 --- a/benchmarks/parsetostruct.upb_table.c +++ b/benchmarks/parsetostruct.upb_table.c @@ -3,18 +3,18 @@ #include "upb_data.h" #include "upb_def.h" -#include "upb_parse.h" +#include "upb_decoder.h" static struct upb_symtab *s; static upb_strptr str; static struct upb_msgdef *def; static upb_msg *msgs[NUM_MESSAGES]; -static upb_parser *parser; +static upb_decoder *decoder; static upb_msgsink *sink; static bool initialize() { - // Initialize upb state, parse descriptor. + // Initialize upb state, decode descriptor. struct upb_status status = UPB_STATUS_INIT; s = upb_symtab_new(); upb_strptr fds = upb_strreadfile(MESSAGE_DESCRIPTOR_FILE); @@ -49,7 +49,7 @@ static bool initialize() fprintf(stderr, "Error reading " MESSAGE_FILE "\n"); return false; } - parser = upb_parser_new(def); + decoder = upb_decoder_new(def); sink = upb_msgsink_new(def); return true; } @@ -60,7 +60,7 @@ static void cleanup() upb_msg_unref(msgs[i], def); upb_string_unref(str); upb_symtab_unref(s); - upb_parser_free(parser); + upb_decoder_free(decoder); upb_msgsink_free(sink); } @@ -69,11 +69,11 @@ static size_t run(int i) struct upb_status status = UPB_STATUS_INIT; upb_msg *msg = msgs[i%NUM_MESSAGES]; upb_msgsink_reset(sink, msg); - upb_parser_reset(parser, upb_msgsink_sink(sink)); + upb_decoder_reset(decoder, upb_msgsink_sink(sink)); upb_msg_clear(msg, def); - size_t parsed = upb_parser_parse(parser, str, &status); - if(!upb_ok(&status) || parsed != upb_strlen(str)) { - fprintf(stderr, "Parse error: %s\n", status.msg); + size_t decoded = upb_decoder_decode(decoder, str, &status); + if(!upb_ok(&status) || decoded != upb_strlen(str)) { + fprintf(stderr, "Decode error: %s\n", status.msg); return 0; } return upb_strlen(str); -- cgit v1.2.3