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.63 by root, Mon Aug 27 01:49:01 2007 UTC vs.
Revision 1.64 by root, Mon Aug 27 02:03:23 2007 UTC

700 U32 depth; // recursion depth 700 U32 depth; // recursion depth
701 U32 maxdepth; // recursion depth limit 701 U32 maxdepth; // recursion depth limit
702} dec_t; 702} dec_t;
703 703
704inline void 704inline void
705decode_comment (dec_t *dec)
706{
707 // only '#'-style comments allowed a.t.m.
708
709 while (*dec->cur && *dec->cur != 0x0a && *dec->cur != 0x0d)
710 ++dec->cur;
711}
712
713inline void
705decode_ws (dec_t *dec) 714decode_ws (dec_t *dec)
706{ 715{
707 for (;;) 716 for (;;)
708 { 717 {
709 char ch = *dec->cur; 718 char ch = *dec->cur;
710 719
711 if (ch > 0x20 720 if (ch > 0x20)
721 {
722 if (expect_false (ch == '#'))
723 {
724 if (dec->json.flags & F_RELAXED)
725 decode_comment (dec);
726 else
727 break;
728 }
729 else
730 break;
731 }
712 || (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)) 732 else if (ch != 0x20 && ch != 0x0a && ch != 0x0d && ch != 0x09)
713 break; 733 break; // parse error, but let higher level handle it, gives better error messages
714
715 if (ch == '#' && dec->json.flags & F_RELAXED)
716 ++dec->cur;
717 734
718 ++dec->cur; 735 ++dec->cur;
719 } 736 }
720} 737}
721 738

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines