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.42 by root, Sat Jun 23 22:56:08 2007 UTC vs.
Revision 1.43 by root, Sat Jun 23 23:49:29 2007 UTC

55 55
56#define expect_false(expr) expect ((expr) != 0, 0) 56#define expect_false(expr) expect ((expr) != 0, 0)
57#define expect_true(expr) expect ((expr) != 0, 1) 57#define expect_true(expr) expect ((expr) != 0, 1)
58 58
59static HV *json_stash; // JSON::XS:: 59static HV *json_stash; // JSON::XS::
60static SV *json_true, *json_false;
60 61
61///////////////////////////////////////////////////////////////////////////// 62/////////////////////////////////////////////////////////////////////////////
62// utility functions 63// utility functions
63 64
64static UV * 65static UV *
1031 1032
1032 case 't': 1033 case 't':
1033 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4)) 1034 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
1034 { 1035 {
1035 dec->cur += 4; 1036 dec->cur += 4;
1036 return newSViv (1); 1037 return SvREFCNT_inc (json_true);
1037 } 1038 }
1038 else 1039 else
1039 ERR ("'true' expected"); 1040 ERR ("'true' expected");
1040 1041
1041 break; 1042 break;
1042 1043
1043 case 'f': 1044 case 'f':
1044 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5)) 1045 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
1045 { 1046 {
1046 dec->cur += 5; 1047 dec->cur += 5;
1047 return newSViv (0); 1048 return SvREFCNT_inc (json_false);
1048 } 1049 }
1049 else 1050 else
1050 ERR ("'false' expected"); 1051 ERR ("'false' expected");
1051 1052
1052 break; 1053 break;
1163 : i >= 'a' && i <= 'f' ? i - 'a' + 10 1164 : i >= 'a' && i <= 'f' ? i - 'a' + 10
1164 : i >= 'A' && i <= 'F' ? i - 'A' + 10 1165 : i >= 'A' && i <= 'F' ? i - 'A' + 10
1165 : -1; 1166 : -1;
1166 1167
1167 json_stash = gv_stashpv ("JSON::XS", 1); 1168 json_stash = gv_stashpv ("JSON::XS", 1);
1169
1170 json_true = get_sv ("JSON::XS::true" , 1); SvREADONLY_on (json_true );
1171 json_false = get_sv ("JSON::XS::false", 1); SvREADONLY_on (json_false);
1168} 1172}
1169 1173
1170PROTOTYPES: DISABLE 1174PROTOTYPES: DISABLE
1171 1175
1172SV *new (char *dummy) 1176SV *new (char *dummy)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines