diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-07-16 14:14:13 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-07-16 14:14:13 -0700 |
commit | daf36f07473b627ef634f8f66379a45ac99d32fc (patch) | |
tree | 96212a3f25627b89ea7a1bab6fa576252c045a2e /upb/pb/glue.c | |
parent | b6ca2718c8e9fcb601054b76af96e22920a2070e (diff) |
Get rid of upb_symtabtxn.
This type was nothing but a map of defs.
We can as easily just pass an array of defs
into upb_symtab_add().
Diffstat (limited to 'upb/pb/glue.c')
-rw-r--r-- | upb/pb/glue.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/upb/pb/glue.c b/upb/pb/glue.c index 3763ae0..d4d04bc 100644 --- a/upb/pb/glue.c +++ b/upb/pb/glue.c @@ -66,19 +66,16 @@ void upb_read_descriptor(upb_symtab *symtab, const char *str, size_t len, upb_decoder_initforhandlers(&d, h); upb_handlers_unref(h); upb_descreader r; - upb_symtabtxn txn; - upb_symtabtxn_init(&txn); - upb_descreader_init(&r, &txn); + upb_descreader_init(&r); upb_decoder_reset(&d, upb_stringsrc_bytesrc(&strsrc), 0, UINT64_MAX, &r); upb_decoder_decode(&d, status); + int n; + upb_def **defs = upb_descreader_getdefs(&r, &n); // Set default accessors and layouts on all messages. - // for msgdef in symtabtxn: - upb_symtabtxn_iter i; - upb_symtabtxn_begin(&i, &txn); - for(; !upb_symtabtxn_done(&i); upb_symtabtxn_next(&i)) { - upb_def *def = upb_symtabtxn_iter_def(&i); + for(int i = 0; i < n; i++) { + upb_def *def = defs[i]; upb_msgdef *md = upb_dyncast_msgdef(def); if (!md) return; // For field in msgdef: @@ -90,9 +87,8 @@ void upb_read_descriptor(upb_symtab *symtab, const char *str, size_t len, upb_msgdef_layout(md); } - if (upb_ok(status)) upb_symtab_commit(symtab, &txn, status); + if (upb_ok(status)) upb_symtab_add(symtab, defs, n, status); - upb_symtabtxn_uninit(&txn); upb_descreader_uninit(&r); upb_stringsrc_uninit(&strsrc); upb_decoder_uninit(&d); |