diff options
author | Chris Fallin <cfallin@c1f.net> | 2015-01-06 15:44:09 -0800 |
---|---|---|
committer | Chris Fallin <cfallin@c1f.net> | 2015-01-06 15:44:09 -0800 |
commit | fd1a3ff11d5854c34ba66c63598cdc5fd234e399 (patch) | |
tree | bac4a2445906d444a132004761f6b8e1693a9124 /ruby/ext/google/protobuf_c/repeated_field.c | |
parent | 644a6a1da71385e9d7a7a26b3476c93fdd71788c (diff) | |
download | protobuf-fd1a3ff11d5854c34ba66c63598cdc5fd234e399.tar.gz protobuf-fd1a3ff11d5854c34ba66c63598cdc5fd234e399.tar.bz2 protobuf-fd1a3ff11d5854c34ba66c63598cdc5fd234e399.zip |
Support for maps in the MRI C Ruby extension.
This adds the Map container and support for parsing and serializing maps
in the protobuf wire format (as defined by the C++ implementation, with
MapEntry submessages in a repeated field). JSON map
serialization/parsing are not yet supported as these will require some
changes to upb as well.
Diffstat (limited to 'ruby/ext/google/protobuf_c/repeated_field.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/repeated_field.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ruby/ext/google/protobuf_c/repeated_field.c b/ruby/ext/google/protobuf_c/repeated_field.c index 6bd13b07..6e3f0bc7 100644 --- a/ruby/ext/google/protobuf_c/repeated_field.c +++ b/ruby/ext/google/protobuf_c/repeated_field.c @@ -324,6 +324,10 @@ VALUE RepeatedField_deep_copy(VALUE _self) { * element types are equal, their lengths are equal, and each element is equal. * Elements are compared as per normal Ruby semantics, by calling their :== * methods (or performing a more efficient comparison for primitive types). + * + * Repeated fields with dissimilar element types are never equal, even if value + * comparison (for example, between integers and floats) would have otherwise + * indicated that every element has equal value. */ VALUE RepeatedField_eq(VALUE _self, VALUE _other) { if (_self == _other) { @@ -458,7 +462,7 @@ VALUE RepeatedField_plus(VALUE _self, VALUE list) { return dupped; } -static void validate_type_class(upb_fieldtype_t type, VALUE klass) { +void validate_type_class(upb_fieldtype_t type, VALUE klass) { if (rb_iv_get(klass, kDescriptorInstanceVar) == Qnil) { rb_raise(rb_eArgError, "Type class has no descriptor. Please pass a " |