summaryrefslogtreecommitdiff
path: root/src/upbc.c
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 /src/upbc.c
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 'src/upbc.c')
-rw-r--r--src/upbc.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/upbc.c b/src/upbc.c
index 4cfa6e6..428ec41 100644
--- a/src/upbc.c
+++ b/src/upbc.c
@@ -191,29 +191,12 @@ int main(int argc, char *argv[])
// TODO: make upb_parsedesc use a separate symtab, so we can use it here when
// importing descriptor.proto.
upb_symtab *s = upb_symtab_new();
- upb_symtab_add_descriptorproto(s);
- upb_symtab *s2 = upb_symtab_new();
upb_status status = UPB_STATUS_INIT;
-
- upb_stringsrc strsrc;
- upb_stringsrc_init(&strsrc);
- upb_stringsrc_reset(&strsrc, descriptor);
-
- upb_decoder d;
- upb_msgdef *fds_msgdef = upb_symtab_fds_def(s);
- upb_decoder_init(&d, fds_msgdef);
- upb_decoder_reset(&d, upb_stringsrc_bytesrc(&strsrc));
-
- upb_symtab_addfds(s2, upb_decoder_src(&d), &status);
- upb_stringsrc_uninit(&strsrc);
- upb_decoder_uninit(&d);
- upb_def_unref(UPB_UPCAST(fds_msgdef));
-
+ upb_parsedesc(s, descriptor, &status);
if(!upb_ok(&status)) {
upb_printerr(&status);
error("Failed to parse input file descriptor\n");
}
-
upb_status_uninit(&status);
/* Emit output files. */
@@ -232,7 +215,6 @@ int main(int argc, char *argv[])
free(defs);
upb_string_unref(descriptor);
upb_symtab_unref(s);
- upb_symtab_unref(s2);
fclose(h_const_file);
return 0;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback