From 2a617bf12c8e1f7f689e3767bf7e4582d76c4f39 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 24 Jul 2010 18:18:09 -0700 Subject: Optimizations and bugfix to benchmark. --- benchmarks/parsestream.upb_table.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/parsestream.upb_table.c b/benchmarks/parsestream.upb_table.c index 1e18119..16979b0 100644 --- a/benchmarks/parsestream.upb_table.c +++ b/benchmarks/parsestream.upb_table.c @@ -85,15 +85,14 @@ static size_t run(int i) upb_decoder_reset(decoder, upb_stringsrc_bytesrc(stringsrc)); upb_src *src = upb_decoder_src(decoder); upb_fielddef *f; - upb_string *str = NULL; int depth = 0; while(1) { - while((f = upb_src_getdef(src)) != NULL) { + while(!upb_src_eof(src) && (f = upb_src_getdef(src)) != NULL) { if(upb_issubmsg(f)) { upb_src_startmsg(src); ++depth; } else if(upb_isstring(f)) { - tmp_str = upb_string_tryrecycle(str); + tmp_str = upb_string_tryrecycle(tmp_str); upb_src_getstr(src, tmp_str); } else { // Primitive type. -- cgit v1.2.3