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.82 by root, Wed Mar 26 02:35:45 2008 UTC vs.
Revision 1.83 by root, Wed Mar 26 22:54:38 2008 UTC

101 int incr_mode; 101 int incr_mode;
102} JSON; 102} JSON;
103 103
104///////////////////////////////////////////////////////////////////////////// 104/////////////////////////////////////////////////////////////////////////////
105// utility functions 105// utility functions
106
107INLINE SV *
108get_bool (const char *name)
109{
110 SV *sv = get_sv (name, 1);
111
112 SvREADONLY_on (sv);
113 SvREADONLY_on (SvRV (sv));
114
115 return sv;
116}
106 117
107INLINE void 118INLINE void
108shrink (SV *sv) 119shrink (SV *sv)
109{ 120{
110 sv_utf8_downgrade (sv, 1); 121 sv_utf8_downgrade (sv, 1);
1343 case 't': 1354 case 't':
1344 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4)) 1355 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
1345 { 1356 {
1346 dec->cur += 4; 1357 dec->cur += 4;
1347#if JSON_SLOW 1358#if JSON_SLOW
1348 json_true = get_sv ("JSON::XS::true", 1); SvREADONLY_on (json_true); 1359 json_true = get_bool ("JSON::XS::true");
1349#endif 1360#endif
1350 return SvREFCNT_inc (json_true); 1361 return newSVsv (json_true);
1351 } 1362 }
1352 else 1363 else
1353 ERR ("'true' expected"); 1364 ERR ("'true' expected");
1354 1365
1355 break; 1366 break;
1357 case 'f': 1368 case 'f':
1358 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5)) 1369 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
1359 { 1370 {
1360 dec->cur += 5; 1371 dec->cur += 5;
1361#if JSON_SLOW 1372#if JSON_SLOW
1362 json_false = get_sv ("JSON::XS::false", 1); SvREADONLY_on (json_false); 1373 json_false = get_bool ("JSON::XS::false");
1363#endif 1374#endif
1364 return SvREFCNT_inc (json_false); 1375 return newSVsv (json_false);
1365 } 1376 }
1366 else 1377 else
1367 ERR ("'false' expected"); 1378 ERR ("'false' expected");
1368 1379
1369 break; 1380 break;
1607 : -1; 1618 : -1;
1608 1619
1609 json_stash = gv_stashpv ("JSON::XS" , 1); 1620 json_stash = gv_stashpv ("JSON::XS" , 1);
1610 json_boolean_stash = gv_stashpv ("JSON::XS::Boolean", 1); 1621 json_boolean_stash = gv_stashpv ("JSON::XS::Boolean", 1);
1611 1622
1612 json_true = get_sv ("JSON::XS::true" , 1); SvREADONLY_on (json_true ); 1623 json_true = get_bool ("JSON::XS::true");
1613 json_false = get_sv ("JSON::XS::false", 1); SvREADONLY_on (json_false); 1624 json_false = get_bool ("JSON::XS::false");
1614} 1625}
1615 1626
1616PROTOTYPES: DISABLE 1627PROTOTYPES: DISABLE
1617 1628
1618void CLONE (...) 1629void CLONE (...)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines