summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-05-22 18:07:16 -0400
committerAaron Patterson <aaron.patterson@gmail.com>2010-05-22 18:07:16 -0400
commit71f8441ada40e151c5846c9686751f0c92a81e71 (patch)
treeb312d85dd7594431ca0d08fe237066df70d282bd
parente232744e1ffcb2322a911140f508023c67866c2c (diff)
downloadpsych-71f8441ada40e151c5846c9686751f0c92a81e71.zip
merging from ruby
-rw-r--r--ext/psych/emitter.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/psych/emitter.c b/ext/psych/emitter.c
index ad1fe36..0400f7e 100644
--- a/ext/psych/emitter.c
+++ b/ext/psych/emitter.c
@@ -207,12 +207,15 @@ static VALUE scalar(
) {
yaml_emitter_t * emitter;
yaml_event_t event;
+#ifdef HAVE_RUBY_ENCODING_H
+ rb_encoding *encoding;
+#endif
Data_Get_Struct(self, yaml_emitter_t, emitter);
Check_Type(value, T_STRING);
#ifdef HAVE_RUBY_ENCODING_H
- rb_encoding * encoding = rb_utf8_encoding();
+ encoding = rb_utf8_encoding();
value = rb_str_export_to_enc(value, encoding);
@@ -324,10 +327,13 @@ static VALUE start_mapping(
) {
yaml_emitter_t * emitter;
yaml_event_t event;
+#ifdef HAVE_RUBY_ENCODING_H
+ rb_encoding *encoding;
+#endif
Data_Get_Struct(self, yaml_emitter_t, emitter);
#ifdef HAVE_RUBY_ENCODING_H
- rb_encoding * encoding = rb_utf8_encoding();
+ encoding = rb_utf8_encoding();
if(!NIL_P(anchor)) {
Check_Type(anchor, T_STRING);