From 26d98ca94f2f049e8767b4a9a33d185a3d7ea0fd Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 24 Oct 2013 12:43:19 -0700 Subject: Merge from Google-internal development: - rewritten decoder; interpreted decoder is bytecode-based, JIT decoder no longer falls back to the interpreter. - C++ improvements: C++11-compatible iterators, upb::reffed_ptr for RAII refcounting, better upcast/downcast support. - removed the gross upb_value abstraction from public upb.h. --- upb/symtab.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'upb/symtab.c') diff --git a/upb/symtab.c b/upb/symtab.c index 8b56f89..31ae132 100644 --- a/upb/symtab.c +++ b/upb/symtab.c @@ -11,24 +11,24 @@ #include bool upb_symtab_isfrozen(const upb_symtab *s) { - return upb_refcounted_isfrozen(upb_upcast(s)); + return upb_refcounted_isfrozen(UPB_UPCAST(s)); } void upb_symtab_ref(const upb_symtab *s, const void *owner) { - upb_refcounted_ref(upb_upcast(s), owner); + upb_refcounted_ref(UPB_UPCAST(s), owner); } void upb_symtab_unref(const upb_symtab *s, const void *owner) { - upb_refcounted_unref(upb_upcast(s), owner); + upb_refcounted_unref(UPB_UPCAST(s), owner); } void upb_symtab_donateref( const upb_symtab *s, const void *from, const void *to) { - upb_refcounted_donateref(upb_upcast(s), from, to); + upb_refcounted_donateref(UPB_UPCAST(s), from, to); } void upb_symtab_checkref(const upb_symtab *s, const void *owner) { - upb_refcounted_checkref(upb_upcast(s), owner); + upb_refcounted_checkref(UPB_UPCAST(s), owner); } static void upb_symtab_free(upb_refcounted *r) { @@ -47,7 +47,7 @@ static const struct upb_refcounted_vtbl vtbl = {NULL, &upb_symtab_free}; upb_symtab *upb_symtab_new(const void *owner) { upb_symtab *s = malloc(sizeof(*s)); - upb_refcounted_init(upb_upcast(s), &vtbl, owner); + upb_refcounted_init(UPB_UPCAST(s), &vtbl, owner); upb_strtable_init(&s->symtab, UPB_CTYPE_PTR); return s; } @@ -100,7 +100,7 @@ const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym, static upb_def *upb_resolvename(const upb_strtable *t, const char *base, const char *sym) { if(strlen(sym) == 0) return NULL; - if(sym[0] == UPB_SYMBOL_SEPARATOR) { + if(sym[0] == '.') { // Symbols starting with '.' are absolute, so we do a single lookup. // Slice to omit the leading '.' upb_value v; @@ -243,7 +243,7 @@ bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor, upb_msgdef *m = upb_dyncast_msgdef_mutable(def); if (!m) continue; // Type names are resolved relative to the message in which they appear. - const char *base = upb_def_fullname(upb_upcast(m)); + const char *base = upb_msgdef_fullname(m); upb_msg_iter j; for(upb_msg_begin(&j, m); !upb_msg_done(&j); upb_msg_next(&j)) { -- cgit v1.2.3