diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-08-12 13:47:24 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-08-12 13:47:24 -0700 |
commit | 2282d2489bd8db3cd4ddbe0dd813732bffcf6452 (patch) | |
tree | 814fc94cd8ca4993363fb0ebe45b14e320a7a792 /descriptor/descriptor.h | |
parent | 89a6c6d71f87bab63ee17c60f0feb56215f5c116 (diff) |
Refactoring: unify upb_msg.
The cost is that a upb_msg will now always have an overhead
of 2*sizeof(void*). This is comparable to proto2 overhead.
The benefit is that upb_msg is now self-describing, and
read-only algorithms can now operate on a upb_msg regardless
of the memory-management scheme.
Also, upb_array and upb_string now know inherently if they
own their associated memory, and upb_array has a generic
pointer for memory management purposes like upb_msg does.
Diffstat (limited to 'descriptor/descriptor.h')
-rw-r--r-- | descriptor/descriptor.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/descriptor/descriptor.h b/descriptor/descriptor.h index 39d3117..7096023 100644 --- a/descriptor/descriptor.h +++ b/descriptor/descriptor.h @@ -131,6 +131,8 @@ typedef struct google_protobuf_MethodOptions /* The message definitions themselves. */ struct google_protobuf_UninterpretedOption_NamePart { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -144,6 +146,8 @@ struct google_protobuf_UninterpretedOption_NamePart { UPB_DEFINE_MSG_ARRAY(google_protobuf_UninterpretedOption_NamePart) struct google_protobuf_DescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -167,6 +171,8 @@ struct google_protobuf_DescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_DescriptorProto) struct google_protobuf_EnumDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -182,6 +188,8 @@ struct google_protobuf_EnumDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumDescriptorProto) struct google_protobuf_UninterpretedOption { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -203,6 +211,8 @@ struct google_protobuf_UninterpretedOption { UPB_DEFINE_MSG_ARRAY(google_protobuf_UninterpretedOption) struct google_protobuf_FileDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -228,6 +238,8 @@ struct google_protobuf_FileDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_FileDescriptorProto) struct google_protobuf_MethodDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -245,6 +257,8 @@ struct google_protobuf_MethodDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_MethodDescriptorProto) struct google_protobuf_EnumValueOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -256,6 +270,8 @@ struct google_protobuf_EnumValueOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumValueOptions) struct google_protobuf_EnumValueDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -271,6 +287,8 @@ struct google_protobuf_EnumValueDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumValueDescriptorProto) struct google_protobuf_ServiceDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -286,6 +304,8 @@ struct google_protobuf_ServiceDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_ServiceDescriptorProto) struct google_protobuf_FileDescriptorSet { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -297,6 +317,8 @@ struct google_protobuf_FileDescriptorSet { UPB_DEFINE_MSG_ARRAY(google_protobuf_FileDescriptorSet) struct google_protobuf_DescriptorProto_ExtensionRange { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -310,6 +332,8 @@ struct google_protobuf_DescriptorProto_ExtensionRange { UPB_DEFINE_MSG_ARRAY(google_protobuf_DescriptorProto_ExtensionRange) struct google_protobuf_FieldOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -329,6 +353,8 @@ struct google_protobuf_FieldOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_FieldOptions) struct google_protobuf_FileOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -348,6 +374,8 @@ struct google_protobuf_FileOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_FileOptions) struct google_protobuf_MessageOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -361,6 +389,8 @@ struct google_protobuf_MessageOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_MessageOptions) struct google_protobuf_EnumOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -372,6 +402,8 @@ struct google_protobuf_EnumOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_EnumOptions) struct google_protobuf_FieldDescriptorProto { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -397,6 +429,8 @@ struct google_protobuf_FieldDescriptorProto { UPB_DEFINE_MSG_ARRAY(google_protobuf_FieldDescriptorProto) struct google_protobuf_ServiceOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { @@ -408,6 +442,8 @@ struct google_protobuf_ServiceOptions { UPB_DEFINE_MSG_ARRAY(google_protobuf_ServiceOptions) struct google_protobuf_MethodOptions { + struct upb_msgdef *def; + void *gptr; union { uint8_t bytes[1]; struct { |