Subject: | Bare.xs won't compile with many Microsoft Compilers |
Hi,
With some Microsoft Compilers, Bare.xs will not compile. The attached
patch addresses this issue portably (ie without breaking other
compilers).
I think the current version of Bare.xs might build ok with Visual
Studio 8.0 and later (untested), but it certainly won't build with
Visual Studio 6.0 and Visual Studio 7.x (both of which are commonly
used).
Cheers,
Rob
Subject: | XML_Bare.diff |
--- Bare.xs_orig Tue Apr 28 01:10:50 2009
+++ Bare.xs Tue Apr 28 01:08:04 2009
@@ -99,11 +99,11 @@
SV *newarrayref = newRV_noinc( (SV *) newarray );
SV *newref = newRV( (SV *) SvRV( *cur ) );
-
+ SV *ob = cxml2obj();
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,6 +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 ) {
@@ -151,9 +154,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 +273,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 +283,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 );