From ac2689cec721eb94b49dfbfed310e2e0e3bdfa2b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 21 Apr 2016 16:26:52 -0700 Subject: Put oneofs in the same table as fields. (#60) * Put oneofs in the same table as fields. Oneofs and fields are not allowed to have names that conflict, so we might as well put them all in the same table. This also allows an efficient operation that looks for both fields and oneofs in a single lookup. Added support for OneofDef to Lua to allow testing of this. * Addressed PR comments. --- upb/refcounted.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'upb/refcounted.h') diff --git a/upb/refcounted.h b/upb/refcounted.h index 54c1127..115fc43 100644 --- a/upb/refcounted.h +++ b/upb/refcounted.h @@ -103,10 +103,11 @@ struct upb_refcounted { #ifdef UPB_DEBUG_REFS extern upb_alloc upb_alloc_debugrefs; -#define UPB_REFCOUNT_INIT(refs, ref2s) \ - {&static_refcount, NULL, NULL, 0, true, refs, ref2s} +#define UPB_REFCOUNT_INIT(vtbl, refs, ref2s) \ + {&static_refcount, NULL, vtbl, 0, true, refs, ref2s} #else -#define UPB_REFCOUNT_INIT(refs, ref2s) {&static_refcount, NULL, NULL, 0, true} +#define UPB_REFCOUNT_INIT(vtbl, refs, ref2s) \ + {&static_refcount, NULL, vtbl, 0, true} #endif UPB_BEGIN_EXTERN_C -- cgit v1.2.3