diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-09-09 14:23:16 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2016-09-09 14:23:16 -0700 |
commit | bb872be0c0e40a25b7529bce98643688a85b612e (patch) | |
tree | 231397f0f7346adb04487aa977fa9cc8f3818725 /upb/descriptor | |
parent | 074a050bb10d9f132c6612260c086e2eb07061b9 (diff) |
Addressed CR comments: simplify slightly.
Diffstat (limited to 'upb/descriptor')
-rw-r--r-- | upb/descriptor/reader.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index be3eed8..4164bc7 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -570,10 +570,9 @@ static size_t field_ondefaultval(void *closure, const void *hd, const char *buf, static bool field_ononeofindex(void *closure, const void *hd, int32_t index) { upb_descreader *r = closure; upb_oneofdef *o = upb_descreader_getoneof(r, index); - bool ok; + bool ok = upb_oneofdef_addfield(o, r->f, NULL, NULL); UPB_UNUSED(hd); - ok = upb_oneofdef_addfield(o, r->f, NULL, NULL); UPB_ASSERT(ok); return true; } @@ -585,12 +584,11 @@ static size_t oneof_name(void *closure, const void *hd, const char *buf, upb_descreader *r = closure; upb_descreader_frame *f = &r->stack[r->stack_len-1]; upb_oneofdef *o = upb_descreader_getoneof(r, f->oneof_index++); - bool ok; char *name_null_terminated = upb_strndup(buf, n); + bool ok = upb_oneofdef_setname(o, name_null_terminated, NULL); UPB_UNUSED(hd); UPB_UNUSED(handle); - ok = upb_oneofdef_setname(o, name_null_terminated, NULL); UPB_ASSERT(ok); free(name_null_terminated); return n; |