This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove NEW_ from PERL_NEW_COPY_ON_WRITE
authorFather Chrysostomos <sprout@cpan.org>
Mon, 29 Jun 2015 01:30:29 +0000 (18:30 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 29 Jun 2015 15:20:28 +0000 (08:20 -0700)
dump.c
makedef.pl
op.c
perl.c
perl.h
sv.c
sv.h

diff --git a/dump.c b/dump.c
index 4f7b48d..c4d4018 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1620,7 +1620,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
            if (!re)
                Perl_dump_indent(aTHX_ level, file, "  LEN = %"IVdf"\n",
                                       (IV)SvLEN(sv));
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
            if (SvIsCOW(sv) && SvLEN(sv))
                Perl_dump_indent(aTHX_ level, file, "  COW_REFCNT = %d\n",
                                       CowREFCNT(sv));
index 362797a..297cbc7 100644 (file)
@@ -285,7 +285,7 @@ else {
                         );
 }
 
-unless ($define{'PERL_NEW_COPY_ON_WRITE'}) {
+unless ($define{'PERL_COPY_ON_WRITE'}) {
     ++$skip{Perl_sv_setsv_cow};
 }
 
diff --git a/op.c b/op.c
index c50da69..e00e754 100644 (file)
--- a/op.c
+++ b/op.c
@@ -11949,7 +11949,7 @@ Perl_ck_svconst(pTHX_ OP *o)
     SV * const sv = cSVOPo->op_sv;
     PERL_ARGS_ASSERT_CK_SVCONST;
     PERL_UNUSED_CONTEXT;
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
     /* Since the read-only flag may be used to protect a string buffer, we
        cannot do copy-on-write with existing read-only scalars that are not
        already copy-on-write scalars.  To allow $_ = "hello" to do COW with
diff --git a/perl.c b/perl.c
index b6a3d87..cbb66e0 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1692,6 +1692,9 @@ S_Internals_V(pTHX_ CV *cv)
 #  ifdef PERL_BOOL_AS_CHAR
                             " PERL_BOOL_AS_CHAR"
 #  endif
+#  ifdef PERL_COPY_ON_WRITE
+                            " PERL_COPY_ON_WRITE"
+#  endif
 #  ifdef PERL_DISABLE_PMC
                             " PERL_DISABLE_PMC"
 #  endif
@@ -1737,9 +1740,6 @@ S_Internals_V(pTHX_ CV *cv)
 #  ifdef PERL_MEM_LOG_NOIMPL
                             " PERL_MEM_LOG_NOIMPL"
 #  endif
-#  ifdef PERL_NEW_COPY_ON_WRITE
-                            " PERL_NEW_COPY_ON_WRITE"
-#  endif
 #  ifdef PERL_PERTURB_KEYS_DETERMINISTIC
                             " PERL_PERTURB_KEYS_DETERMINISTIC"
 #  endif
diff --git a/perl.h b/perl.h
index 9715e57..bcfeee9 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2643,12 +2643,12 @@ typedef AV PAD;
 typedef struct padnamelist PADNAMELIST;
 typedef struct padname PADNAME;
 
-/* enable PERL_NEW_COPY_ON_WRITE by default */
-#if !defined(PERL_NEW_COPY_ON_WRITE) && !defined(PERL_NO_COW)
-#  define PERL_NEW_COPY_ON_WRITE
+/* enable PERL_COPY_ON_WRITE by default */
+#if !defined(PERL_COPY_ON_WRITE) && !defined(PERL_NO_COW)
+#  define PERL_COPY_ON_WRITE
 #endif
 
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
 #  define PERL_ANY_COW
 #else
 # define PERL_SAWAMPERSAND
diff --git a/sv.c b/sv.c
index efe6e3a..b4a36e5 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1583,7 +1583,7 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
        s = SvPVX_mutable(sv);
     }
 
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
     /* the new COW scheme uses SvPVX(sv)[SvLEN(sv)-1] (if spare)
      * to store the COW count. So in general, allocate one more byte than
      * asked for, to make it likely this byte is always spare: and thus
@@ -4621,7 +4621,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* sstr, const I32 flags)
         }
        else if (flags & SV_COW_SHARED_HASH_KEYS
              &&
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
                 (sflags & SVf_IsCOW
                   ? (!len ||
                        (  (CHECK_COWBUF_THRESHOLD(cur,len) || SvLEN(dstr) < cur+1)
@@ -4752,7 +4752,7 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *sstr)
     STRLEN cur = SvCUR(sstr);
     STRLEN len = SvLEN(sstr);
     char *new_pv;
-#if defined(PERL_DEBUG_READONLY_COW) && defined(PERL_NEW_COPY_ON_WRITE)
+#if defined(PERL_DEBUG_READONLY_COW) && defined(PERL_COPY_ON_WRITE)
     const bool already = cBOOL(SvIsCOW(sstr));
 #endif
 
@@ -5097,7 +5097,7 @@ S_sv_uncow(pTHX_ SV * const sv, const U32 flags)
                 sv_dump(sv);
         }
         SvIsCOW_off(sv);
-# ifdef PERL_NEW_COPY_ON_WRITE
+# ifdef PERL_COPY_ON_WRITE
        if (len) {
            /* Must do this first, since the CowREFCNT uses SvPVX and
            we need to write to CowREFCNT, or de-RO the whole buffer if we are
@@ -8158,7 +8158,7 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append)
        if (fd >= 0 && (PerlLIO_fstat(fd, &st) == 0) && S_ISREG(st.st_mode))  {
            const Off_t offset = PerlIO_tell(fp);
            if (offset != (Off_t) -1 && st.st_size + append > offset) {
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
                 /* Add an extra byte for the sake of copy-on-write's
                  * buffer reference count. */
                (void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 2));
diff --git a/sv.h b/sv.h
index 5b5994e..49cafe4 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1864,7 +1864,7 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>.
 #define SV_CHECK_THINKFIRST_COW_DROP(sv) if (SvTHINKFIRST(sv)) \
                                    sv_force_normal_flags(sv, SV_COW_DROP_PV)
 
-#ifdef PERL_NEW_COPY_ON_WRITE
+#ifdef PERL_COPY_ON_WRITE
 #   define SvCANCOW(sv)                                            \
        (SvIsCOW(sv)                                         \
         ? SvLEN(sv) ? CowREFCNT(sv) != SV_COW_REFCNT_MAX : 1 \