From 61e5d367ff180a4fcd48dd06b9918a9d37edc766 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 18 Feb 2011 18:17:06 -0800 Subject: 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). --- src/upbc.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/upbc.c') 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; -- cgit v1.2.3