summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-26 16:08:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-26 16:08:03 +0000
commitf850cf28660c7b9a708767d779c16263668afe65 (patch)
treef598d966ddc28f0948cb0b00aea65c58cdae5f2b /ext/nkf
parent5cc05692813f0ba819180dc43df58837f9d612d9 (diff)
* ext/nkf/nkf.c (rb_nkf_convert): avoid GC.
reported in [ruby-dev:36909] and patched [ruby-dev:36941] by mame. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/nkf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index a0c14b5..d9db1de 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -135,6 +135,7 @@ int nkf_split_options(const char *arg)
static VALUE
rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
{
+ volatile tmp;
reinit();
StringValue(opt);
nkf_split_options(RSTRING_PTR(opt));
@@ -155,7 +156,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
StringValue(src);
input = (unsigned char *)RSTRING_PTR(src);
i_len = RSTRING_LEN(src);
- result = rb_str_new(0, i_len*3 + 10);
+ tmp = result = rb_str_new(0, i_len*3 + 10);
output_ctr = 0;
output = (unsigned char *)RSTRING_PTR(result);