Fix typo in description.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index 02c1fe8..6c32f66 100644 (file)
--- a/op.c
+++ b/op.c
@@ -211,11 +211,13 @@ Perl_allocmy(pTHX_ char *name)
     PADOFFSET off;
 
     /* complain about "my $<special_var>" etc etc */
-    if (!(PL_in_my == KEY_our ||
+    if (*name &&
+       !(PL_in_my == KEY_our ||
          isALPHA(name[1]) ||
          (USE_UTF8_IN_NAMES && UTF8_IS_START(name[1])) ||
-         (name[1] == '_' && (*name == '$' || (int)strlen(name) > 2))))
+         (name[1] == '_' && (*name == '$' || name[2]))))
     {
+       /* name[2] is true if strlen(name) > 2  */
        if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
            /* 1999-02-27 mjd@plover.com */
            char *p;
@@ -405,7 +407,7 @@ Perl_op_clear(pTHX_ OP *o)
 clear_pmop:
        {
            HV * const pmstash = PmopSTASH(cPMOPo);
-           if (pmstash && SvREFCNT(pmstash)) {
+           if (pmstash && !SvIS_FREED(pmstash)) {
                MAGIC * const mg = mg_find((SV*)pmstash, PERL_MAGIC_symtab);
                if (mg) {
                    PMOP *pmop = (PMOP*) mg->mg_obj;
@@ -2056,7 +2058,6 @@ Perl_fold_constants(pTHX_ register OP *o)
        /* XXX might want a ck_negate() for this */
        cUNOPo->op_first->op_private &= ~OPpCONST_STRICT;
        break;
-    case OP_SPRINTF:
     case OP_UCFIRST:
     case OP_LCFIRST:
     case OP_UC:
@@ -3298,15 +3299,6 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
            /* Result of assignment is always 1 (or we'd be dead already) */
            return newSVOP(OP_CONST, 0, newSViv(1));
        }
-       /* optimise C<my @x = ()> to C<my @x>, and likewise for hashes */
-       if ((left->op_type == OP_PADAV || left->op_type == OP_PADHV)
-               && right->op_type == OP_STUB
-               && (left->op_private & OPpLVAL_INTRO))
-       {
-           op_free(right);
-           left->op_flags &= ~(OPf_REF|OPf_SPECIAL);
-           return left;
-       }
        curop = list(force_list(left));
        o = newBINOP(OP_AASSIGN, flags, list(force_list(right)), curop);
        o->op_private = (U8)(0 | (flags >> 8));
@@ -4345,9 +4337,6 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
                SAVEFREESV(PL_compcv);
                goto done;
            }
-           /* ahem, death to those who redefine active sort subs */
-           if (PL_curstackinfo->si_type == PERLSI_SORT && PL_sortcop == CvSTART(cv))
-               Perl_croak(aTHX_ "Can't redefine active sort subroutine %s", name);
            if (block) {
                if (ckWARN(WARN_REDEFINE)
                    || (CvCONST(cv)
@@ -4626,9 +4615,10 @@ Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv)
     CvCONST_on(cv);
     sv_setpvn((SV*)cv, "", 0);  /* prototype is "" */
 
+#ifdef USE_ITHREADS
     if (stash)
        CopSTASH_free(PL_curcop);
-
+#endif
     LEAVE;
 
     return cv;
@@ -5799,19 +5789,6 @@ Perl_ck_sassign(pTHX_ OP *o)
            return kid;
        }
     }
-    /* optimise C<my $x = undef> to C<my $x> */
-    if (kid->op_type == OP_UNDEF) {
-       OP * const kkid = kid->op_sibling;
-       if (kkid && kkid->op_type == OP_PADSV
-               && (kkid->op_private & OPpLVAL_INTRO))
-       {
-           cLISTOPo->op_first = NULL;
-           kid->op_sibling = NULL;
-           op_free(o);
-           op_free(kid);
-           return kkid;
-       }
-    }
     return o;
 }
 
@@ -5943,8 +5920,9 @@ Perl_ck_require(pTHX_ OP *o)
 
            for (s = SvPVX(sv); *s; s++) {
                if (*s == ':' && s[1] == ':') {
+                   const STRLEN len = strlen(s+2)+1;
                    *s = '/';
-                   Move(s+2, s+1, strlen(s+2)+1, char);
+                   Move(s+2, s+1, len, char);
                    SvCUR_set(sv, SvCUR(sv) - 1);
                }
            }