summaryrefslogtreecommitdiff
path: root/src/upb_def.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-12-06 13:41:37 -0800
committerJoshua Haberman <joshua@reverberate.org>2009-12-06 13:41:37 -0800
commite15f834a916d64b80a0da9cdc4ee0bd4439b6bf4 (patch)
treeabd7dd38ceabf6aa75059551a0d339f6ed45cced /src/upb_def.h
parent08b4a91204ff7174c381f887d87878d8bb1181ff (diff)
Circular references truly work now, along with a test.
One simplification to come.
Diffstat (limited to 'src/upb_def.h')
-rw-r--r--src/upb_def.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/upb_def.h b/src/upb_def.h
index 09ae5d2..bc7e733 100644
--- a/src/upb_def.h
+++ b/src/upb_def.h
@@ -49,9 +49,9 @@ enum upb_def_type {
// This typedef is more space-efficient than declaring an enum var directly.
typedef uint8_t upb_def_type_t;
-// Common members.
struct upb_def {
struct upb_string *fqname; // Fully qualified.
+ upb_atomic_refcount_t refcount;
upb_def_type_t type;
// These members that pertain to cyclic collection could technically go in
@@ -60,11 +60,10 @@ struct upb_def {
// because structure alignment will otherwise leave three bytes empty between
// type and refcount. It is also makes ref and unref more efficient, because
// we don't have to downcast to msgdef before checking the is_cyclic flag.
- bool is_cyclic; // Is this def part of a cycle?
- upb_field_count_t visiting_submsg; // Helper for depth-first search.
-
+ //
// See .c file for description of refcounting scheme.
- upb_atomic_refcount_t refcount;
+ uint8_t max_cycle_len;
+ upb_field_count_t visiting_submsg; // Used during initialization dfs.
upb_atomic_refcount_t cycle_refcount;
};
@@ -113,6 +112,7 @@ struct upb_fielddef {
// For the case of an enum or a submessage, points to the def for that type.
// We own a ref on this def.
+ bool owned;
struct upb_def *def;
};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback