Commit 61874bc6 authored by Joshua Haberman's avatar Joshua Haberman

Merge pull request #831 from haberman/ruby-tinyfix

A very small fix to silence some warnings.
parents 0e5686a7 14e2b4fa
PATH PATH
remote: . remote: .
specs: specs:
google-protobuf (3.0.0.alpha.4) google-protobuf (3.0.0.alpha.4.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
...@@ -23,3 +23,6 @@ DEPENDENCIES ...@@ -23,3 +23,6 @@ DEPENDENCIES
rake-compiler rake-compiler
rubygems-tasks rubygems-tasks
test-unit test-unit
BUNDLED WITH
1.10.6
...@@ -35,11 +35,13 @@ ...@@ -35,11 +35,13 @@
// For more information, see: // For more information, see:
// https://bugs.ruby-lang.org/issues/11328 // https://bugs.ruby-lang.org/issues/11328
VALUE noleak_rb_str_cat(VALUE rb_str, const char *str, long len) { VALUE noleak_rb_str_cat(VALUE rb_str, const char *str, long len) {
char *p;
size_t oldlen = RSTRING_LEN(rb_str); size_t oldlen = RSTRING_LEN(rb_str);
rb_str_modify_expand(rb_str, len); rb_str_modify_expand(rb_str, len);
char *p = RSTRING_PTR(rb_str); p = RSTRING_PTR(rb_str);
memcpy(p + oldlen, str, len); memcpy(p + oldlen, str, len);
rb_str_set_len(rb_str, oldlen + len); rb_str_set_len(rb_str, oldlen + len);
return rb_str;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment