diff options
author | Pete Johns <pete.johns@envato.com> | 2015-12-23 21:55:42 +1100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2016-07-01 15:00:18 +0200 |
commit | d5115edb0ea309620e09c9970a5add4bbb2abac4 (patch) | |
tree | dc74ebd518e80bfad9bbb30996a3c356b6e8ba63 /ext/json/ext/generator/generator.c | |
parent | 1c2901905c938ffd19620cc6a06cbb2b34d8ba05 (diff) | |
download | json-d5115edb0ea309620e09c9970a5add4bbb2abac4.tar.gz |
RB_GC_GUARD to protect from premature GC
https://github.com/ruby/ruby/blob/trunk/doc/extension.rdoc#appendix-e-rb_gc_guard-to-protect-from-premature-gc
Diffstat (limited to 'ext/json/ext/generator/generator.c')
-rw-r--r-- | ext/json/ext/generator/generator.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 8cc0c27..2b56721 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -222,6 +222,7 @@ static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string) unicode_escape_to_buffer(buffer, buf, (UTF16)((ch & halfMask) + UNI_SUR_LOW_START)); } } + RB_GC_GUARD(string); } /* Converts string to a JSON string in FBuffer buffer, where only the |