From 559e23c796f973a65d05c76e211835b126ee8ac8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 17 Jun 2011 10:34:29 -0700 Subject: Major refactoring: abandon upb_msg, add upb_accessors. Next on the chopping block is upb_string. --- benchmarks/parsestream.upb_table.c | 4 ++-- benchmarks/parsetostruct.upb_table.c | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/parsestream.upb_table.c b/benchmarks/parsestream.upb_table.c index a4aebd8..b1763da 100644 --- a/benchmarks/parsestream.upb_table.c +++ b/benchmarks/parsestream.upb_table.c @@ -36,7 +36,7 @@ static bool initialize() upb_printerr(&status); return false; } - upb_parsedesc(s, fds_str, &status); + upb_read_descriptor(s, fds_str, &status); upb_string_unref(fds_str); if(!upb_ok(&status)) { @@ -64,7 +64,7 @@ static bool initialize() // Cause all messages to be read, but do nothing when they are. upb_handlerset hset = {NULL, NULL, value, startsubmsg, NULL, NULL, NULL}; upb_handlers_reghandlerset(handlers, def, &hset); - upb_decoder_init(&decoder, handlers); + upb_decoder_initforhandlers(&decoder, handlers); upb_handlers_unref(handlers); upb_stringsrc_init(&stringsrc); return true; diff --git a/benchmarks/parsetostruct.upb_table.c b/benchmarks/parsetostruct.upb_table.c index f05395f..f0ddb99 100644 --- a/benchmarks/parsetostruct.upb_table.c +++ b/benchmarks/parsetostruct.upb_table.c @@ -9,7 +9,7 @@ static upb_string *input_str; static upb_msgdef *def; -static upb_msg *msg; +static void *msg; static upb_stringsrc strsrc; static upb_decoder d; @@ -25,7 +25,7 @@ static bool initialize() upb_printerr(&status); return false; } - upb_parsedesc(s, fds_str, &status); + upb_read_descriptor(s, fds_str, &status); upb_string_unref(fds_str); if(!upb_ok(&status)) { @@ -49,13 +49,10 @@ static bool initialize() return false; } upb_status_uninit(&status); - msg = upb_msg_new(def); + msg = upb_stdmsg_new(def); upb_stringsrc_init(&strsrc); - upb_handlers *handlers = upb_handlers_new(); - upb_msg_reghandlers(handlers, def); - upb_decoder_init(&d, handlers); - upb_handlers_unref(handlers); + upb_decoder_initformsgdef(&d, def); if (!BYREF) { // Pretend the input string is stack-allocated, which will force its data @@ -74,7 +71,7 @@ static void cleanup() input_str->refcount.v = 1; } upb_string_unref(input_str); - upb_msg_unref(msg, def); + upb_stdmsg_free(msg, def); upb_def_unref(UPB_UPCAST(def)); upb_stringsrc_uninit(&strsrc); upb_decoder_uninit(&d); -- cgit v1.2.3