--- Bare.xs_orig Mon Apr 27 12:34:29 2009 +++ Bare.xs Mon Apr 27 13:00:50 2009 @@ -97,13 +97,13 @@ if( SvTYPE( SvRV(*cur) ) == SVt_PVHV ) { AV *newarray = newAV(); SV *newarrayref = newRV_noinc( (SV *) newarray ); - + + SV *ob = cxml2obj(); SV *newref = newRV( (SV *) SvRV( *cur ) ); - + hv_delete( output, curnode->name, curnode->namelen, 0 ); hv_store( output, curnode->name, curnode->namelen, newarrayref, 0 ); av_push( newarray, newref ); - SV *ob = cxml2obj(); av_push( newarray, ob ); } else { @@ -141,7 +141,9 @@ int numatts = curnode->numatt; SV *attval; SV *attatt; - + HV *output = newHV(); + SV *outputref = newRV( (SV *) output ); + int length = curnode->numchildren; if( ( length + numatts ) == 0 ) { if( curnode->vallen ) { @@ -151,9 +153,6 @@ return newSViv( 1 ); //&PL_sv_undef; } - HV *output = newHV(); - SV *outputref = newRV( (SV *) output ); - if( length ) { curnode = curnode->firstchild; for( i = 0; i < length; i++ ) { @@ -273,6 +272,9 @@ c_parsefile(filename) char * filename CODE: + char *data; + unsigned long len; + FILE *handle; PERL_HASH(vhash, "value", 5); PERL_HASH(ahash, "_att", 4); PERL_HASH(chash, "comment", 7); @@ -280,9 +282,6 @@ PERL_HASH(ihash, "_i", 2 ); PERL_HASH(zhash, "_z", 2 ); PERL_HASH(cdhash, "_cdata", 6 ); - char *data; - unsigned long len; - FILE *handle; handle = fopen(filename,"r"); fseek( handle, 0, SEEK_END );