summaryrefslogtreecommitdiff
path: root/tests/test_vs_proto2.cc
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-18 18:17:06 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-18 18:17:06 -0800
commit61e5d367ff180a4fcd48dd06b9918a9d37edc766 (patch)
treedb9b726919615984bc2bc4750340b90f58777cb2 /tests/test_vs_proto2.cc
parentff23340fe2983b1f034b0e156807b328417d2310 (diff)
Change the API for getting the bootstrapped defs.
The symtab that contains them is now hidden, and you can look them up by name but there is no access to the symtab itself, so there is no risk of mutating it (by extending it, adding other defs to it, etc).
Diffstat (limited to 'tests/test_vs_proto2.cc')
-rw-r--r--tests/test_vs_proto2.cc16
1 files changed, 1 insertions, 15 deletions
diff --git a/tests/test_vs_proto2.cc b/tests/test_vs_proto2.cc
index 749eedf..1839123 100644
--- a/tests/test_vs_proto2.cc
+++ b/tests/test_vs_proto2.cc
@@ -213,26 +213,13 @@ int main(int argc, char *argv[])
fprintf(stderr, "Couldn't read " MESSAGE_DESCRIPTOR_FILE ".\n");
return 1;
}
- upb_symtab_add_descriptorproto(symtab);
- upb_def *fds_msgdef = upb_symtab_lookup(
- symtab, UPB_STRLIT("google.protobuf.FileDescriptorSet"));
- assert(fds_msgdef);
-
- upb_stringsrc ssrc;
- upb_stringsrc_init(&ssrc);
- upb_stringsrc_reset(&ssrc, fds);
- upb_decoder decoder;
- upb_decoder_init(&decoder, upb_downcast_msgdef(fds_msgdef));
- upb_decoder_reset(&decoder, upb_stringsrc_bytesrc(&ssrc));
- upb_symtab_addfds(symtab, upb_decoder_src(&decoder), &status);
+ upb_parsedesc(symtab, fds, &status);
if(!upb_ok(&status)) {
fprintf(stderr, "Error importing " MESSAGE_DESCRIPTOR_FILE ": ");
upb_printerr(&status);
return 1;
}
upb_string_unref(fds);
- upb_decoder_uninit(&decoder);
- upb_stringsrc_uninit(&ssrc);
upb_string *proto_name = upb_strdupc(MESSAGE_NAME);
upb_def *def = upb_symtab_lookup(symtab, proto_name);
@@ -260,7 +247,6 @@ int main(int argc, char *argv[])
upb_msg_unref(upb_msg, msgdef);
upb_def_unref(UPB_UPCAST(msgdef));
- upb_def_unref(fds_msgdef);
upb_string_unref(str);
upb_symtab_unref(symtab);
upb_status_uninit(&status);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback