summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-01-15 18:12:28 -0800
committerJoshua Haberman <joshua@reverberate.org>2010-01-15 18:12:28 -0800
commit9116c697f845e7ca215628029800c36f7dfbfaee (patch)
treef5f416d54f9fb1034abc40022855dbc2fbec61a7 /benchmarks
parent57d6353a3c225cbfa523d7f15cef2691e8806741 (diff)
upb_parser -> upb_decoder
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/parsetostruct.upb_table.c18
1 files changed, 9 insertions, 9 deletions
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);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback