aboutsummaryrefslogtreecommitdiff
path: root/ruby/ext/google/protobuf_c/repeated_field.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2016-07-25 10:09:15 -0700
committerGitHub <noreply@github.com>2016-07-25 10:09:15 -0700
commit44bd6bda58d3889c06e82c5060609182f124aba3 (patch)
treefacc0a600e9b52dc5c94d48f891c8c4a845eca67 /ruby/ext/google/protobuf_c/repeated_field.c
parent06220303323f3cce425706540defcd7a29d42ec2 (diff)
parentd07a9963df7c01d978c0749eb5753f98a3f0dc65 (diff)
downloadprotobuf-44bd6bda58d3889c06e82c5060609182f124aba3.tar.gz
protobuf-44bd6bda58d3889c06e82c5060609182f124aba3.tar.bz2
protobuf-44bd6bda58d3889c06e82c5060609182f124aba3.zip
Merge pull request #1821 from haberman/rubyfreezestr
Ruby: encode and freeze strings when the are assigned or decoded.
Diffstat (limited to 'ruby/ext/google/protobuf_c/repeated_field.c')
-rw-r--r--ruby/ext/google/protobuf_c/repeated_field.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ruby/ext/google/protobuf_c/repeated_field.c b/ruby/ext/google/protobuf_c/repeated_field.c
index 83afbc91..47c207a5 100644
--- a/ruby/ext/google/protobuf_c/repeated_field.c
+++ b/ruby/ext/google/protobuf_c/repeated_field.c
@@ -244,6 +244,11 @@ void* RepeatedField_index_native(VALUE _self, int index) {
return RepeatedField_memoryat(self, index, element_size);
}
+int RepeatedField_size(VALUE _self) {
+ RepeatedField* self = ruby_to_RepeatedField(_self);
+ return self->size;
+}
+
/*
* Private ruby method, used by RepeatedField.pop
*/