diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-26 20:05:55 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-27 00:51:44 -0700 |
commit | 71739502e6eb02644b90372ce6020b03ebc8a428 (patch) | |
tree | 5ac1024dcd5d479d34bf2c00477100b832abd737 /pp.c | |
parent | a75b6b17e2a4ee33072d32e33d29786cd1577fcd (diff) | |
download | perl-71739502e6eb02644b90372ce6020b03ebc8a428.tar.gz |
Make pp.c:pp_srand slightly less repetitive
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -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(); @@ -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); |