summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2011-07-08 06:46:06 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2011-07-08 06:59:35 +0900
commit1b19c43a4f459988474f86ccbbfc92a420af58e8 (patch)
tree16efe5f1ffd17c3b93466a229085d00e6680f5b0 /ext/json
parent08793aa47dfca15f678842fd5cd583fe2fb67136 (diff)
downloadjson-1b19c43a4f459988474f86ccbbfc92a420af58e8.tar.gz
should not modify argument
* ext/json/ext/parser/parser.h (FORCE_UTF8): should not modify encoding of the argument.
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/ext/parser/parser.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/ext/parser/parser.h b/ext/json/ext/parser/parser.h
index 2be640e..f2ce5a4 100644
--- a/ext/json/ext/parser/parser.h
+++ b/ext/json/ext/parser/parser.h
@@ -9,7 +9,7 @@
#ifdef HAVE_RUBY_ENCODING_H
#include "ruby/encoding.h"
-#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
+#define FORCE_UTF8(obj) ((obj) = rb_enc_associate(rb_str_dup(obj), rb_utf8_encoding()))
#else
#define FORCE_UTF8(obj)
#endif