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.49 by root, Sun Jul 1 23:40:07 2007 UTC vs.
Revision 1.50 by root, Mon Jul 2 00:29:38 2007 UTC

524 encode_hv (enc, (HV *)sv); 524 encode_hv (enc, (HV *)sv);
525 else if (svt == SVt_PVAV) 525 else if (svt == SVt_PVAV)
526 encode_av (enc, (AV *)sv); 526 encode_av (enc, (AV *)sv);
527 else if (svt < SVt_PVAV) 527 else if (svt < SVt_PVAV)
528 { 528 {
529 if (SvNIOK (sv) && SvIV (sv) == 0) 529 STRLEN len = 0;
530 char *pv = svt ? SvPV (sv, len) : 0;
531
532 if (len == 1 && *pv == '0')
530 encode_str (enc, "false", 5, 0); 533 encode_str (enc, "false", 5, 0);
531 else if (SvNIOK (sv) && SvIV (sv) == 1) 534 else if (len == 1 && *pv == '1')
532 encode_str (enc, "true", 4, 0); 535 encode_str (enc, "true", 4, 0);
533 else 536 else
534 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1", 537 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
535 SvPV_nolen (sv_2mortal (newRV_inc (sv)))); 538 SvPV_nolen (sv_2mortal (newRV_inc (sv))));
536 } 539 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines