ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.xs
(Generate patch)

Comparing JSON-XS/XS.xs (file contents):
Revision 1.128 by root, Fri Oct 7 05:18:48 2016 UTC vs.
Revision 1.129 by root, Wed Nov 16 18:06:34 2016 UTC

1689fail: 1689fail:
1690 return 0; 1690 return 0;
1691} 1691}
1692 1692
1693static SV * 1693static SV *
1694decode_json (SV *string, JSON *json, char **offset_return) 1694decode_json (SV *string, JSON *json, STRLEN *offset_return)
1695{ 1695{
1696 dec_t dec; 1696 dec_t dec;
1697 SV *sv; 1697 SV *sv;
1698 1698
1699 /* work around bugs in 5.10 where manipulating magic values 1699 /* work around bugs in 5.10 where manipulating magic values
1752 1752
1753 decode_ws (&dec); 1753 decode_ws (&dec);
1754 sv = decode_sv (&dec); 1754 sv = decode_sv (&dec);
1755 1755
1756 if (offset_return) 1756 if (offset_return)
1757 *offset_return = dec.cur; 1757 *offset_return = dec.cur - SvPVX (string);
1758 1758 else if (sv)
1759 if (!(offset_return || !sv))
1760 { 1759 {
1761 // check for trailing garbage 1760 // check for trailing garbage
1762 decode_ws (&dec); 1761 decode_ws (&dec);
1763 1762
1764 if (*dec.cur) 1763 if (*dec.cur)
2111 2110
2112void decode_prefix (JSON *self, SV *jsonstr) 2111void decode_prefix (JSON *self, SV *jsonstr)
2113 PPCODE: 2112 PPCODE:
2114{ 2113{
2115 SV *sv; 2114 SV *sv;
2116 char *offset; 2115 STRLEN offset;
2117 PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN; 2116 PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN;
2118 EXTEND (SP, 2); 2117 EXTEND (SP, 2);
2119 PUSHs (sv); 2118 PUSHs (sv);
2120 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, offset)))); 2119 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset))));
2121} 2120}
2122 2121
2123void incr_parse (JSON *self, SV *jsonstr = 0) 2122void incr_parse (JSON *self, SV *jsonstr = 0)
2124 PPCODE: 2123 PPCODE:
2125{ 2124{
2172 2171
2173 if (GIMME_V != G_VOID) 2172 if (GIMME_V != G_VOID)
2174 do 2173 do
2175 { 2174 {
2176 SV *sv; 2175 SV *sv;
2177 char *offset; 2176 STRLEN offset;
2178 2177
2179 if (!INCR_DONE (self)) 2178 if (!INCR_DONE (self))
2180 { 2179 {
2181 incr_parse (self); 2180 incr_parse (self);
2182 2181
2198 } 2197 }
2199 2198
2200 PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN; 2199 PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN;
2201 XPUSHs (sv); 2200 XPUSHs (sv);
2202 2201
2203 self->incr_pos -= offset - SvPVX (self->incr_text); 2202 self->incr_pos -= offset;
2204 self->incr_nest = 0; 2203 self->incr_nest = 0;
2205 self->incr_mode = 0; 2204 self->incr_mode = 0;
2206 2205
2207 sv_chop (self->incr_text, offset); 2206 sv_chop (self->incr_text, SvPVX (self->incr_text) + offset);
2208 } 2207 }
2209 while (GIMME_V == G_ARRAY); 2208 while (GIMME_V == G_ARRAY);
2210} 2209}
2211 2210
2212SV *incr_text (JSON *self) 2211SV *incr_text (JSON *self)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines