summaryrefslogtreecommitdiff
path: root/upb/def.h
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2017-01-21 10:47:58 -0800
committerJosh Haberman <jhaberman@gmail.com>2017-01-21 10:47:58 -0800
commit47da2afd52b0f108085439e3dc8ad5236809fbae (patch)
treecc35bd4029e6204b43062e6b5788c4337f2d49e5 /upb/def.h
parentc850bc0a4e62c1c9c21c1f6cfe3b8293e64831cf (diff)
Make upb::SymbolTable no longer reference-counted.
This transitions it from shared ownership to unique ownership.
Diffstat (limited to 'upb/def.h')
-rw-r--r--upb/def.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/upb/def.h b/upb/def.h
index b2c42a6..b99dcb0 100644
--- a/upb/def.h
+++ b/upb/def.h
@@ -44,8 +44,7 @@ UPB_DECLARE_DERIVED_TYPE(upb::OneofDef, upb::RefCounted, upb_oneofdef,
upb_refcounted)
UPB_DECLARE_DERIVED_TYPE(upb::FileDef, upb::RefCounted, upb_filedef,
upb_refcounted)
-UPB_DECLARE_DERIVED_TYPE(upb::SymbolTable, upb::RefCounted,
- upb_symtab, upb_refcounted)
+UPB_DECLARE_TYPE(upb::SymbolTable, upb_symtab)
/* The maximum message depth that the type graph can have. This is a resource
@@ -1434,10 +1433,8 @@ class upb::SymbolTable {
public:
/* Returns a new symbol table with a single ref owned by "owner."
* Returns NULL if memory allocation failed. */
- static reffed_ptr<SymbolTable> New();
-
- /* Include RefCounted base methods. */
- UPB_REFCOUNTED_CPPMETHODS
+ static SymbolTable* New();
+ static void Free(upb::SymbolTable* table);
/* For all lookup functions, the returned pointer is not owned by the
* caller; it may be invalidated by any non-const call or unref of the
@@ -1527,11 +1524,8 @@ UPB_BEGIN_EXTERN_C
/* Native C API. */
-/* Include refcounted methods like upb_symtab_ref(). */
-UPB_REFCOUNTED_CMETHODS(upb_symtab, upb_symtab_upcast)
-
-upb_symtab *upb_symtab_new(const void *owner);
-void upb_symtab_freeze(upb_symtab *s);
+upb_symtab *upb_symtab_new();
+void upb_symtab_free(upb_symtab* s);
const upb_def *upb_symtab_resolve(const upb_symtab *s, const char *base,
const char *sym);
const upb_def *upb_symtab_lookup(const upb_symtab *s, const char *sym);
@@ -1562,13 +1556,11 @@ UPB_END_EXTERN_C
#ifdef __cplusplus
/* C++ inline wrappers. */
namespace upb {
-inline reffed_ptr<SymbolTable> SymbolTable::New() {
- upb_symtab *s = upb_symtab_new(&s);
- return reffed_ptr<SymbolTable>(s, &s);
+inline SymbolTable* SymbolTable::New() {
+ return upb_symtab_new();
}
-
-inline void SymbolTable::Freeze() {
- return upb_symtab_freeze(this);
+inline void SymbolTable::Free(SymbolTable* s) {
+ upb_symtab_free(s);
}
inline const Def *SymbolTable::Resolve(const char *base,
const char *sym) const {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback