Skip to content

Commit

Permalink
bool: return the same true and false objects
Browse files Browse the repository at this point in the history
not a fresh sv was was previosulty a ref to true/false
  • Loading branch information
Reini Urban committed Nov 25, 2015
1 parent c060c6a commit 752377a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions XS.xs
Original file line number Diff line number Diff line change
Expand Up @@ -2413,11 +2413,10 @@ decode_sv (pTHX_ dec_t *dec)
case 't':
if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
{
dMY_CXT;
dec->cur += 4;
{
dMY_CXT;
return newSVsv (MY_CXT.json_true);
}
/*return newSVrv(MY_CXT.json_true, "JSON::PP::Boolean");*/
return SvREFCNT_inc_NN(MY_CXT.json_true);
}
else
ERR ("'true' expected");
Expand All @@ -2427,11 +2426,9 @@ decode_sv (pTHX_ dec_t *dec)
case 'f':
if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
{
dMY_CXT;
dec->cur += 5;
{
dMY_CXT;
return newSVsv (MY_CXT.json_false);
}
return SvREFCNT_inc_NN(MY_CXT.json_false);
}
else
ERR ("'false' expected");
Expand All @@ -2442,7 +2439,7 @@ decode_sv (pTHX_ dec_t *dec)
if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "null", 4))
{
dec->cur += 4;
return newSVsv (&PL_sv_undef);
return SvREFCNT_inc_NN(&PL_sv_undef);
}
else
ERR ("'null' expected");
Expand Down

0 comments on commit 752377a

Please sign in to comment.