From b5f5ee867e6c91b77490dc8894236f17a47bde00 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 23 Nov 2011 16:19:22 -0800 Subject: Refinement of upb_bytesrc interface. Added a upb_byteregion that tracks a region of the input buffer; decoders use this instead of using a upb_bytesrc directly. upb_byteregion is also used as the way of passing a string to a upb_handlers callback. This symmetry makes decoders compose better; if you want to take a parsed string and decode it as something else, you can take the string directly from the callback and feed it as input to another parser. A commented-out version of a pinning interface is present; I decline to actually implement it (and accept its extra complexity) until/unless it is clear that it is actually a win. But it is included as a proof-of-concept, to show that it fits well with the existing interface. --- tests/tests.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/tests.c') diff --git a/tests/tests.c b/tests/tests.c index e8c335b..83fb3ef 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -16,15 +16,16 @@ static upb_symtab *load_test_proto() { ASSERT(s); upb_status status = UPB_STATUS_INIT; if (!upb_load_descriptor_file_into_symtab(s, descriptor_file, &status)) { - fprintf(stderr, "Error loading descriptor file: %s\n", upb_status_getstr(&status)); + fprintf(stderr, "Error loading descriptor file: %s\n", + upb_status_getstr(&status)); exit(1); } upb_status_uninit(&status); return s; } -static upb_flow_t upb_test_onvalue(void *closure, upb_value fval, upb_value val) { - (void)closure; +static upb_flow_t upb_test_onvalue(void *c, upb_value fval, upb_value val) { + (void)c; (void)fval; (void)val; return UPB_CONTINUE; @@ -56,6 +57,7 @@ static void test_upb_symtab() { upb_symtab_unref(s); const upb_msgdef *m = upb_downcast_msgdef_const(def); upb_msg_iter i = upb_msg_begin(m); + ASSERT(!upb_msg_done(i)); upb_fielddef *f = upb_msg_iter_field(i); ASSERT(upb_hassubdef(f)); upb_def *def2 = f->def; -- cgit v1.2.3