Skip to content

Commit

Permalink
Make pp.c:pp_srand slightly less repetitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Father Chrysostomos committed Jun 27, 2012
1 parent a75b6b1 commit 7173950
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pp.c
Expand Up @@ -3255,17 +3255,14 @@ PP(pp_chr)
dVAR; dSP; dTARGET;
char *tmps;
UV value;
SV *top = POPs;

SvGETMAGIC(TOPs);
if (((SvIOKp(TOPs) && !SvIsUV(TOPs) && SvIV_nomg(TOPs) < 0)
SvGETMAGIC(top);
if (!IN_BYTES /* under bytes, chr(-1) eq chr(0xff), etc. */
&& ((SvIOKp(top) && !SvIsUV(top) && SvIV_nomg(top) < 0)
||
((SvNOKp(TOPs) || (SvOK(TOPs) && !SvIsUV(TOPs)))
&& SvNV_nomg(TOPs) < 0.0))) {
if (IN_BYTES) {
value = SvUV_nomg(TOPs); /* chr(-1) eq chr(0xff), etc. */
(void)POPs;
} else {
SV *top = POPs;
((SvNOKp(top) || (SvOK(top) && !SvIsUV(top)))
&& SvNV_nomg(top) < 0.0))) {
if (ckWARN(WARN_UTF8)) {
if (SvGMAGICAL(top)) {
SV *top2 = sv_newmortal();
Expand All @@ -3276,10 +3273,8 @@ PP(pp_chr)
"Invalid negative number (%"SVf") in chr", top);
}
value = UNICODE_REPLACEMENT;
}
} else {
value = SvUV_nomg(TOPs);
(void)POPs;
value = SvUV_nomg(top);
}

SvUPGRADE(TARG,SVt_PV);
Expand Down

0 comments on commit 7173950

Please sign in to comment.