From 7f0d3bb83dbb7590f3008182a8b27ecf9f0220d3 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Tue, 8 Mar 2016 16:21:37 -0800 Subject: Make OneofDef stop deriving from Def. It is clear now that oneofs are different form other defs in one important way: they are not top-level constructs that can stand on their own in a SymbolTable, for example. If you are iterating over a list of Defs in a SymbolTable, there is no chance you will run into a oneof. To reflect this reality, OneofDef no longer derives from Def, and the UPB_DEF_ONEOF is no longer an enum value that needs to be handled. --- upb/structdefs.int.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'upb/structdefs.int.h') diff --git a/upb/structdefs.int.h b/upb/structdefs.int.h index b7b36fa..467963b 100644 --- a/upb/structdefs.int.h +++ b/upb/structdefs.int.h @@ -150,15 +150,16 @@ struct upb_enumdef { /* upb_oneofdef ***************************************************************/ struct upb_oneofdef { - upb_def base; + upb_refcounted base; + const char *name; upb_strtable ntof; upb_inttable itof; const upb_msgdef *parent; }; #define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \ - { UPB_DEF_INIT(name, UPB_DEF_ENUM, refs, ref2s), ntof, itof } + { UPB_REFCOUNT_INIT(refs, ref2s), name, ntof, itof } /* upb_symtab *****************************************************************/ -- cgit v1.2.3