diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-06 08:21:47 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-06 08:21:47 -0800 |
commit | 4667ed4be921b2142321e47c8ccc6a35a9189277 (patch) | |
tree | 416d9bf9cffa3b9abc99f7f69a68e84df8f0a203 /core/upb_glue.c | |
parent | 806ba1c80d86bd59759cf59efc057662eecbcf65 (diff) |
All tests pass again, valgrind-clean! Next up: benchmarks.
Diffstat (limited to 'core/upb_glue.c')
-rw-r--r-- | core/upb_glue.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/upb_glue.c b/core/upb_glue.c index 7540a3a..541827e 100644 --- a/core/upb_glue.c +++ b/core/upb_glue.c @@ -36,3 +36,19 @@ void upb_strtomsg(upb_string *str, upb_msg *msg, upb_msgdef *md, upb_msgpopulator_uninit(&p); upb_handlers_uninit(&h); } + +void upb_parsedesc(upb_symtab *symtab, upb_string *str, upb_status *status) { + upb_stringsrc strsrc; + upb_stringsrc_init(&strsrc); + upb_stringsrc_reset(&strsrc, str); + + upb_decoder d; + upb_msgdef *fds_msgdef = upb_symtab_fds_def(symtab); + upb_decoder_init(&d, fds_msgdef); + upb_decoder_reset(&d, upb_stringsrc_bytesrc(&strsrc)); + + upb_symtab_addfds(symtab, upb_decoder_src(&d), status); + upb_stringsrc_uninit(&strsrc); + upb_decoder_uninit(&d); + upb_def_unref(UPB_UPCAST(fds_msgdef)); +} |