summaryrefslogtreecommitdiff
path: root/upb/descriptor/reader.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2016-04-19 15:41:33 -0700
committerJoshua Haberman <jhaberman@gmail.com>2016-04-19 15:41:33 -0700
commite6fa3f9d869765544b8e424e8573fe8d9af35534 (patch)
tree3e56beb3bd80470ddad130b2c7f703fb5bb6b5fd /upb/descriptor/reader.c
parent68bc62a7fa5febbf5c8ab2fe8f6171121d18690f (diff)
Changed schema for JSON test to be defined in a .proto file. (#54)
* Changed schema for JSON test to be defined in a .proto file. Before we had lots of code to build these schemas manually, but this was verbose and made it difficult to add to the schema easily. Now we can just write a .proto file and adding fields is easy. To avoid making the tests depend on upbc (and thus Lua) we check in the generated schema. * Made protobuf-compiler a dependency of "make genfiles." * For genfiles download recent protoc that can handle proto3. * Only use new protoc for genfiles.
Diffstat (limited to 'upb/descriptor/reader.c')
-rw-r--r--upb/descriptor/reader.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c
index fc1de78..9717f1d 100644
--- a/upb/descriptor/reader.c
+++ b/upb/descriptor/reader.c
@@ -609,6 +609,17 @@ static bool msg_endfield(void *closure, const void *hd) {
return true;
}
+static bool msg_onmapentry(void *closure, const void *hd, bool mapentry) {
+ upb_descreader *r = closure;
+ upb_msgdef *m = upb_descreader_top(r);
+ UPB_UNUSED(hd);
+
+ upb_msgdef_setmapentry(m, mapentry);
+ r->f = NULL;
+ return true;
+}
+
+
/** Code to register handlers *************************************************/
@@ -679,6 +690,8 @@ static void reghandlers(const void *closure, upb_handlers *h) {
} else if (upbdefs_google_protobuf_FieldOptions_is(m)) {
upb_handlers_setbool(h, F(FieldOptions, lazy), &field_onlazy, NULL);
upb_handlers_setbool(h, F(FieldOptions, packed), &field_onpacked, NULL);
+ } else if (upbdefs_google_protobuf_MessageOptions_is(m)) {
+ upb_handlers_setbool(h, F(MessageOptions, map_entry), &msg_onmapentry, NULL);
}
assert(upb_ok(upb_handlers_status(h)));
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback