diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-10-26 14:41:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-26 14:41:43 -0700 |
commit | 23adfeb00327fbdccacc99806acb1a9a073bd8e0 (patch) | |
tree | f56e93003569b065b7c2fd191e97763e9c1738ab /ruby/ext/google/protobuf_c/message.c | |
parent | a08b03d4c00a5793b88b494f672513f6ad46a681 (diff) | |
download | protobuf-23adfeb00327fbdccacc99806acb1a9a073bd8e0.tar.gz protobuf-23adfeb00327fbdccacc99806acb1a9a073bd8e0.tar.bz2 protobuf-23adfeb00327fbdccacc99806acb1a9a073bd8e0.zip |
Reserve unknown in Ruby (#3763)
* Reserve unknown in ruby
* Revert ruby tests. Wait for cpp impl for conformance test
* Add conformance test for preserving unknown
* Add unknown field conformance test to csharp failure list.
* Fix comments
* Fix comment
* Fix comments
* Fix typo
* Use stringsink_string directly
* Mark hd unused
* Remove unused encodeunknown_handlerfunc
Diffstat (limited to 'ruby/ext/google/protobuf_c/message.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/message.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby/ext/google/protobuf_c/message.c b/ruby/ext/google/protobuf_c/message.c index 42910bfe..bc73d48c 100644 --- a/ruby/ext/google/protobuf_c/message.c +++ b/ruby/ext/google/protobuf_c/message.c @@ -44,6 +44,11 @@ void Message_mark(void* _self) { } void Message_free(void* self) { + stringsink* unknown = ((MessageHeader *)self)->unknown_fields; + if (unknown != NULL) { + stringsink_uninit(unknown); + free(unknown); + } xfree(self); } @@ -67,6 +72,8 @@ VALUE Message_alloc(VALUE klass) { msg->descriptor = desc; rb_ivar_set(ret, descriptor_instancevar_interned, descriptor); + msg->unknown_fields = NULL; + layout_init(desc->layout, Message_data(msg)); return ret; |