summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/pp.c b/pp.c
index 01a90e2855..e148197c97 100644
--- a/pp.c
+++ b/pp.c
@@ -205,7 +205,7 @@ PP(pp_rv2gv)
if (SvROK(sv))
goto wasref;
}
- if (!SvOK(sv)) {
+ if (!SvOK(sv) && sv != &PL_sv_undef) {
/* If this is a 'my' scalar and flag is set then vivify
* NI-S 1999/05/07
*/
@@ -1076,10 +1076,10 @@ PP(pp_repeat)
SP -= items;
}
else { /* Note: mark already snarfed by pp_list */
- SV *tmpstr;
+ SV *tmpstr = POPs;
STRLEN len;
+ bool isutf = DO_UTF8(tmpstr);
- tmpstr = POPs;
SvSetSV(TARG, tmpstr);
SvPV_force(TARG, len);
if (count != 1) {
@@ -1092,7 +1092,10 @@ PP(pp_repeat)
}
*SvEND(TARG) = '\0';
}
- (void)SvPOK_only(TARG);
+ if (isutf)
+ (void)SvPOK_only_UTF8(TARG);
+ else
+ (void)SvPOK_only(TARG);
PUSHTARG;
}
RETURN;
@@ -1199,15 +1202,8 @@ PP(pp_ncmp)
{
dPOPTOPnnrl;
I32 value;
-#ifdef __osf__ /* XXX fix in 5.6.1 --jhi */
-#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
-#define Perl_isnan isnanl
-#else
-#define Perl_isnan isnan
-#endif
-#endif
-#ifdef __osf__ /* XXX fix in 5.6.1 --jhi */
+#ifdef Perl_isnan
if (Perl_isnan(left) || Perl_isnan(right)) {
SETs(&PL_sv_undef);
RETURN;
@@ -1892,6 +1888,7 @@ PP(pp_hex)
STRLEN n_a;
tmps = POPpx;
+ argtype = 1; /* allow underscores */
XPUSHn(scan_hex(tmps, 99, &argtype));
RETURN;
}
@@ -1909,6 +1906,7 @@ PP(pp_oct)
tmps++;
if (*tmps == '0')
tmps++;
+ argtype = 1; /* allow underscores */
if (*tmps == 'x')
value = scan_hex(++tmps, 99, &argtype);
else if (*tmps == 'b')
@@ -2013,12 +2011,12 @@ PP(pp_substr)
RETPUSHUNDEF;
}
else {
- if (utfcurlen) {
+ if (utfcurlen)
sv_pos_u2b(sv, &pos, &rem);
- SvUTF8_on(TARG);
- }
tmps += pos;
sv_setpvn(TARG, tmps, rem);
+ if (utfcurlen)
+ SvUTF8_on(TARG);
if (repl)
sv_insert(sv, pos, rem, repl, repl_len);
else if (lvalue) { /* it's an lvalue! */
@@ -2031,7 +2029,7 @@ PP(pp_substr)
"Attempt to use reference as lvalue in substr");
}
if (SvOK(sv)) /* is it defined ? */
- (void)SvPOK_only(sv);
+ (void)SvPOK_only_UTF8(sv);
else
sv_setpvn(sv,"",0); /* avoid lexical reincarnation */
}
@@ -2214,7 +2212,6 @@ PP(pp_chr)
tmps = SvPVX(TARG);
*tmps++ = value;
*tmps = '\0';
- SvUTF8_off(TARG); /* decontaminate */
(void)SvPOK_only(TARG);
XPUSHs(TARG);
RETURN;
@@ -2547,7 +2544,7 @@ PP(pp_quotemeta)
}
*d = '\0';
SvCUR_set(TARG, d - SvPVX(TARG));
- (void)SvPOK_only(TARG);
+ (void)SvPOK_only_UTF8(TARG);
}
else
sv_setpvn(TARG, s, len);
@@ -3236,7 +3233,7 @@ PP(pp_reverse)
*up++ = *down;
*down-- = tmp;
}
- (void)SvPOK_only(TARG);
+ (void)SvPOK_only_UTF8(TARG);
}
SP = MARK + 1;
SETTARG;
@@ -4445,7 +4442,8 @@ PP(pp_pack)
if ((*pat != 'a' && *pat != 'A' && *pat != 'Z') || pat[1] != '*')
DIE(aTHX_ "/ must be followed by a*, A* or Z*");
lengthcode = sv_2mortal(newSViv(sv_len(items > 0
- ? *MARK : &PL_sv_no)));
+ ? *MARK : &PL_sv_no)
+ + (*pat == 'Z' ? 1 : 0)));
}
switch(datumtype) {
default:
@@ -4743,10 +4741,14 @@ PP(pp_pack)
DIE(aTHX_ "Cannot compress negative numbers");
if (
-#ifdef CXUX_BROKEN_CONSTANT_CONVERT
- adouble <= UV_MAX_cxux
+#if UVSIZE > 4 && UVSIZE >= NVSIZE
+ adouble <= 0xffffffff
#else
+# ifdef CXUX_BROKEN_CONSTANT_CONVERT
+ adouble <= UV_MAX_cxux
+# else
adouble <= UV_MAX
+# endif
#endif
)
{