diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-29 18:58:22 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-29 18:58:22 +0000 |
commit | e43b94231b76d1953b51ba36e7e7fd6399fd2851 (patch) | |
tree | 5ddc3d9635beb92ac3bb1c632350e595ec27419a /ext/psych/emitter.c | |
parent | 7abf7e58e82ecd71655f85c0600a94d3f74c3018 (diff) | |
download | ruby-e43b94231b76d1953b51ba36e7e7fd6399fd2851.tar.gz |
* ext/psych/{emitter,parser,psych}.c: move variable
declaration to the first of the block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/emitter.c')
-rwxr-xr-x[-rw-r--r--] | ext/psych/emitter.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/ext/psych/emitter.c b/ext/psych/emitter.c index 74f91f22bc..befa98e821 100644..100755 --- a/ext/psych/emitter.c +++ b/ext/psych/emitter.c @@ -56,10 +56,10 @@ static VALUE initialize(VALUE self, VALUE io) static VALUE start_stream(VALUE self, VALUE encoding) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); Check_Type(encoding, T_FIXNUM); - yaml_event_t event; yaml_stream_start_event_initialize(&event, (yaml_encoding_t)NUM2INT(encoding)); emit(emitter, &event); @@ -76,9 +76,9 @@ static VALUE start_stream(VALUE self, VALUE encoding) static VALUE end_stream(VALUE self) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_stream_end_event_initialize(&event); emit(emitter, &event); @@ -96,9 +96,12 @@ static VALUE end_stream(VALUE self) static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) { yaml_emitter_t * emitter; + yaml_tag_directive_t * head = NULL; + yaml_tag_directive_t * tail = NULL; + yaml_event_t event; + yaml_version_directive_t version_directive; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_version_directive_t version_directive; Check_Type(version, T_ARRAY); @@ -110,9 +113,6 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) version_directive.minor = NUM2INT(minor); } - yaml_tag_directive_t * head = NULL; - yaml_tag_directive_t * tail = NULL; - if(RTEST(tags)) { int i = 0; @@ -137,7 +137,6 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) } } - yaml_event_t event; yaml_document_start_event_initialize( &event, (RARRAY_LEN(version) > 0) ? &version_directive : NULL, @@ -162,9 +161,9 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) static VALUE end_document(VALUE self, VALUE imp) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_document_end_event_initialize(&event, imp ? 1 : 0); emit(emitter, &event); @@ -189,11 +188,11 @@ static VALUE scalar( VALUE style ) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); Check_Type(value, T_STRING); - yaml_event_t event; yaml_scalar_event_initialize( &event, (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), @@ -225,9 +224,9 @@ static VALUE start_sequence( VALUE style ) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_sequence_start_event_initialize( &event, (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), @@ -250,9 +249,9 @@ static VALUE start_sequence( static VALUE end_sequence(VALUE self) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_sequence_end_event_initialize(&event); emit(emitter, &event); @@ -275,9 +274,9 @@ static VALUE start_mapping( VALUE style ) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_mapping_start_event_initialize( &event, (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), @@ -300,9 +299,9 @@ static VALUE start_mapping( static VALUE end_mapping(VALUE self) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_mapping_end_event_initialize(&event); emit(emitter, &event); @@ -319,9 +318,9 @@ static VALUE end_mapping(VALUE self) static VALUE alias(VALUE self, VALUE anchor) { yaml_emitter_t * emitter; + yaml_event_t event; Data_Get_Struct(self, yaml_emitter_t, emitter); - yaml_event_t event; yaml_alias_event_initialize( &event, (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)) |