summaryrefslogtreecommitdiff
path: root/upb/def.c
diff options
context:
space:
mode:
authorChris Fallin <cfallin@c1f.net>2014-12-15 13:42:24 -0800
committerChris Fallin <cfallin@c1f.net>2014-12-15 16:00:42 -0800
commit3bd667e95f8f00e4c62b670374dd852995c870c4 (patch)
treec8d229241ddab79a69be259fe06cb0ee4a002e46 /upb/def.c
parentefffb86a5ceb7e5ca4c96b2061744958e455192e (diff)
Added msgdef flag to indicate map_entry protos.
Diffstat (limited to 'upb/def.c')
-rw-r--r--upb/def.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/upb/def.c b/upb/def.c
index aa05618..349dfd5 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -1270,6 +1270,7 @@ upb_msgdef *upb_msgdef_new(const void *owner) {
if (!upb_def_init(UPB_UPCAST(m), UPB_DEF_MSG, &vtbl, owner)) goto err2;
if (!upb_inttable_init(&m->itof, UPB_CTYPE_PTR)) goto err2;
if (!upb_strtable_init(&m->ntof, UPB_CTYPE_PTR)) goto err1;
+ m->map_entry = false;
return m;
err1:
@@ -1284,6 +1285,7 @@ upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner) {
if (!newm) return NULL;
bool ok = upb_def_setfullname(UPB_UPCAST(newm),
upb_def_fullname(UPB_UPCAST(m)), NULL);
+ newm->map_entry = m->map_entry;
UPB_ASSERT_VAR(ok, ok);
upb_msg_iter i;
for(upb_msg_begin(&i, m); !upb_msg_done(&i); upb_msg_next(&i)) {
@@ -1387,6 +1389,15 @@ int upb_msgdef_numfields(const upb_msgdef *m) {
return upb_strtable_count(&m->ntof);
}
+void upb_msgdef_setmapentry(upb_msgdef *m, bool map_entry) {
+ assert(!upb_msgdef_isfrozen(m));
+ m->map_entry = map_entry;
+}
+
+bool upb_msgdef_mapentry(const upb_msgdef *m) {
+ return m->map_entry;
+}
+
void upb_msg_begin(upb_msg_iter *iter, const upb_msgdef *m) {
upb_inttable_begin(iter, &m->itof);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback