google-protobuf 3.22.5 → 3.24.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/convert.h +0 -2
- data/ext/google/protobuf_c/defs.c +33 -22
- data/ext/google/protobuf_c/defs.h +0 -2
- data/ext/google/protobuf_c/map.c +4 -2
- data/ext/google/protobuf_c/map.h +0 -2
- data/ext/google/protobuf_c/message.c +16 -6
- data/ext/google/protobuf_c/message.h +0 -2
- data/ext/google/protobuf_c/protobuf.c +36 -150
- data/ext/google/protobuf_c/protobuf.h +21 -6
- data/ext/google/protobuf_c/repeated_field.c +5 -2
- data/ext/google/protobuf_c/repeated_field.h +0 -2
- data/ext/google/protobuf_c/ruby-upb.c +7604 -7307
- data/ext/google/protobuf_c/ruby-upb.h +4734 -2656
- data/lib/google/protobuf/any_pb.rb +24 -5
- data/lib/google/protobuf/api_pb.rb +26 -23
- data/lib/google/protobuf/descriptor_pb.rb +37 -252
- data/lib/google/protobuf/duration_pb.rb +24 -5
- data/lib/google/protobuf/empty_pb.rb +24 -3
- data/lib/google/protobuf/field_mask_pb.rb +24 -4
- data/lib/google/protobuf/object_cache.rb +120 -0
- data/lib/google/protobuf/plugin_pb.rb +25 -28
- data/lib/google/protobuf/source_context_pb.rb +24 -4
- data/lib/google/protobuf/struct_pb.rb +24 -20
- data/lib/google/protobuf/timestamp_pb.rb +24 -5
- data/lib/google/protobuf/type_pb.rb +26 -68
- data/lib/google/protobuf/well_known_types.rb +2 -8
- data/lib/google/protobuf/wrappers_pb.rb +24 -28
- data/lib/google/protobuf.rb +1 -0
- metadata +5 -4
@@ -87,7 +87,6 @@ VALUE RepeatedField_GetRubyWrapper(upb_Array* array, TypeInfo type_info,
|
|
87
87
|
if (val == Qnil) {
|
88
88
|
val = RepeatedField_alloc(cRepeatedField);
|
89
89
|
RepeatedField* self;
|
90
|
-
ObjectCache_Add(array, val);
|
91
90
|
TypedData_Get_Struct(val, RepeatedField, &RepeatedField_type, self);
|
92
91
|
self->array = array;
|
93
92
|
self->arena = arena;
|
@@ -95,11 +94,14 @@ VALUE RepeatedField_GetRubyWrapper(upb_Array* array, TypeInfo type_info,
|
|
95
94
|
if (self->type_info.type == kUpb_CType_Message) {
|
96
95
|
self->type_class = Descriptor_DefToClass(type_info.def.msgdef);
|
97
96
|
}
|
97
|
+
val = ObjectCache_TryAdd(array, val);
|
98
98
|
}
|
99
99
|
|
100
100
|
PBRUBY_ASSERT(ruby_to_RepeatedField(val)->type_info.type == type_info.type);
|
101
101
|
PBRUBY_ASSERT(ruby_to_RepeatedField(val)->type_info.def.msgdef ==
|
102
102
|
type_info.def.msgdef);
|
103
|
+
PBRUBY_ASSERT(ruby_to_RepeatedField(val)->array == array);
|
104
|
+
|
103
105
|
return val;
|
104
106
|
}
|
105
107
|
|
@@ -613,7 +615,8 @@ VALUE RepeatedField_init(int argc, VALUE* argv, VALUE _self) {
|
|
613
615
|
|
614
616
|
self->type_info = TypeInfo_FromClass(argc, argv, 0, &self->type_class, &ary);
|
615
617
|
self->array = upb_Array_New(arena, self->type_info.type);
|
616
|
-
|
618
|
+
VALUE stored_val = ObjectCache_TryAdd(self->array, _self);
|
619
|
+
PBRUBY_ASSERT(stored_val == _self);
|
617
620
|
|
618
621
|
if (ary != Qnil) {
|
619
622
|
if (!RB_TYPE_P(ary, T_ARRAY)) {
|