Updated to new upb APIs.
diff --git a/ruby/ext/google/protobuf_c/defs.h b/ruby/ext/google/protobuf_c/defs.h
index 97a94bb..f559cb0 100644
--- a/ruby/ext/google/protobuf_c/defs.h
+++ b/ruby/ext/google/protobuf_c/defs.h
@@ -40,9 +40,9 @@
// TypeInfo
// -----------------------------------------------------------------------------
-// This bundles a upb_fieldtype_t and msgdef/enumdef when appropriate. This is
+// This bundles a upb_CType and msgdef/enumdef when appropriate. This is
// convenient for functions that need type information but cannot necessarily
-// assume a upb_fielddef will be available.
+// assume a upb_FieldDef will be available.
//
// For example, Google::Protobuf::Map and Google::Protobuf::RepeatedField can
// be constructed with type information alone:
@@ -51,21 +51,21 @@
// Google::Protobuf::RepeatedField.new(:message, FooMessage)
typedef struct {
- upb_fieldtype_t type;
+ upb_CType type;
union {
- const upb_msgdef* msgdef; // When type == UPB_TYPE_MESSAGE
- const upb_enumdef* enumdef; // When type == UPB_TYPE_ENUM
+ const upb_MessageDef* msgdef; // When type == kUpb_CType_Message
+ const upb_EnumDef* enumdef; // When type == kUpb_CType_Enum
} def;
} TypeInfo;
-static inline TypeInfo TypeInfo_get(const upb_fielddef *f) {
- TypeInfo ret = {upb_fielddef_type(f), {NULL}};
+static inline TypeInfo TypeInfo_get(const upb_FieldDef* f) {
+ TypeInfo ret = {upb_FieldDef_CType(f), {NULL}};
switch (ret.type) {
- case UPB_TYPE_MESSAGE:
- ret.def.msgdef = upb_fielddef_msgsubdef(f);
+ case kUpb_CType_Message:
+ ret.def.msgdef = upb_FieldDef_MessageSubDef(f);
break;
- case UPB_TYPE_ENUM:
- ret.def.enumdef = upb_fielddef_enumsubdef(f);
+ case kUpb_CType_Enum:
+ ret.def.enumdef = upb_FieldDef_EnumSubDef(f);
break;
default:
break;
@@ -76,9 +76,9 @@
TypeInfo TypeInfo_FromClass(int argc, VALUE* argv, int skip_arg,
VALUE* type_class, VALUE* init_arg);
-static inline TypeInfo TypeInfo_from_type(upb_fieldtype_t type) {
+static inline TypeInfo TypeInfo_from_type(upb_CType type) {
TypeInfo ret = {type};
- assert(type != UPB_TYPE_MESSAGE && type != UPB_TYPE_ENUM);
+ assert(type != kUpb_CType_Message && type != kUpb_CType_Enum);
return ret;
}
@@ -86,17 +86,17 @@
// Other utilities
// -----------------------------------------------------------------------------
-VALUE Descriptor_DefToClass(const upb_msgdef *m);
+VALUE Descriptor_DefToClass(const upb_MessageDef* m);
// Returns the underlying msgdef, enumdef, or symtab (respectively) for the
// given Descriptor, EnumDescriptor, or DescriptorPool Ruby object.
-const upb_enumdef *EnumDescriptor_GetEnumDef(VALUE enum_desc_rb);
-const upb_symtab *DescriptorPool_GetSymtab(VALUE desc_pool_rb);
-const upb_msgdef *Descriptor_GetMsgDef(VALUE desc_rb);
+const upb_EnumDef* EnumDescriptor_GetEnumDef(VALUE enum_desc_rb);
+const upb_DefPool* DescriptorPool_GetSymtab(VALUE desc_pool_rb);
+const upb_MessageDef* Descriptor_GetMsgDef(VALUE desc_rb);
// Returns a upb field type for the given Ruby symbol
-// (eg. :float => UPB_TYPE_FLOAT).
-upb_fieldtype_t ruby_to_fieldtype(VALUE type);
+// (eg. :float => kUpb_CType_Float).
+upb_CType ruby_to_fieldtype(VALUE type);
// The singleton generated pool (a DescriptorPool object).
extern VALUE generated_pool;