summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-06-26 20:05:55 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-06-27 00:51:44 -0700
commit71739502e6eb02644b90372ce6020b03ebc8a428 (patch)
tree5ac1024dcd5d479d34bf2c00477100b832abd737 /pp.c
parenta75b6b17e2a4ee33072d32e33d29786cd1577fcd (diff)
downloadperl-71739502e6eb02644b90372ce6020b03ebc8a428.tar.gz
Make pp.c:pp_srand slightly less repetitive
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/pp.c b/pp.c
index c3221d5db2..99ff0276c1 100644
--- a/pp.c
+++ b/pp.c
@@ -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);