summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Johns <pete.johns@envato.com>2015-12-23 21:55:42 +1100
committerFlorian Frank <flori@ping.de>2016-07-01 15:00:18 +0200
commitd5115edb0ea309620e09c9970a5add4bbb2abac4 (patch)
treedc74ebd518e80bfad9bbb30996a3c356b6e8ba63
parent1c2901905c938ffd19620cc6a06cbb2b34d8ba05 (diff)
downloadjson-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
-rw-r--r--ext/json/ext/generator/generator.c1
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