--- JSON-XS/XS.xs 2007/05/09 16:33:53 1.31 +++ JSON-XS/XS.xs 2007/05/23 20:26:40 1.33 @@ -374,8 +374,13 @@ // that randomises hash orderings if (enc->flags & F_CANONICAL) { - HE *he, *hes [count]; // if your compiler dies here, you need to enable C99 mode int fast = 1; + HE *he; +#if WIN32 + HE **hes = _alloca (count * sizeof (HE)); +#else + HE *hes [count]; // if your compiler dies here, you need to enable C99 mode +#endif i = 0; while ((he = hv_iternext (hv))) @@ -1011,16 +1016,7 @@ *dec.end = 0; // this should basically be a nop, too, but make sure it's there sv = decode_sv (&dec); - if (offset_return || !sv) - { - offset = dec.flags & F_UTF8 - ? dec.cur - SvPVX (string) - : utf8_distance (dec.cur, SvPVX (string)); - - if (offset_return) - *offset_return = offset; - } - else + if (!(offset_return || !sv)) { // check for trailing garbage decode_ws (&dec); @@ -1033,6 +1029,16 @@ } } + if (offset_return || !sv) + { + offset = dec.flags & F_UTF8 + ? dec.cur - SvPVX (string) + : utf8_distance (dec.cur, SvPVX (string)); + + if (offset_return) + *offset_return = offset; + } + if (!sv) { SV *uni = sv_newmortal ();