This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Unicode-Collate to CPAN version 1.02
[perl5.git] / doop.c
diff --git a/doop.c b/doop.c
index 1593d19..5031af8 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -15,8 +15,8 @@
  */
 
 /* This file contains some common functions needed to carry out certain
- * ops. For example both pp_schomp() and pp_chomp() - scalar and array
- * chomp operations - call the function do_chomp() found in this file.
+ * ops. For example, both pp_sprintf() and pp_prtf() call the function
+ * do_printf() found in this file.
  */
 
 #include "EXTERN.h"
@@ -331,7 +331,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
        const U8 * const e = s + len;
        while (t < e) {
            const U8 ch = *t++;
-           hibit = !NATIVE_IS_INVARIANT(ch);
+           hibit = !NATIVE_BYTE_IS_INVARIANT(ch);
            if (hibit) {
                s = bytes_to_utf8(s, &len);
                break;
@@ -361,7 +361,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
        if (uv < none) {
            s += UTF8SKIP(s);
            matches++;
-           d = uvuni_to_utf8(d, uv);
+           d = uvchr_to_utf8(d, uv);
        }
        else if (uv == none) {
            const int i = UTF8SKIP(s);
@@ -372,7 +372,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
        else if (uv == extra) {
            s += UTF8SKIP(s);
            matches++;
-           d = uvuni_to_utf8(d, final);
+           d = uvchr_to_utf8(d, final);
        }
        else
            s += UTF8SKIP(s);
@@ -432,7 +432,7 @@ S_do_trans_count_utf8(pTHX_ SV * const sv)
        const U8 * const e = s + len;
        while (t < e) {
            const U8 ch = *t++;
-           hibit = !NATIVE_IS_INVARIANT(ch);
+           hibit = !NATIVE_BYTE_IS_INVARIANT(ch);
            if (hibit) {
                start = s = bytes_to_utf8(s, &len);
                break;
@@ -487,7 +487,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
        const U8 * const e = s + len;
        while (t < e) {
            const U8 ch = *t++;
-           hibit = !NATIVE_IS_INVARIANT(ch);
+           hibit = !NATIVE_BYTE_IS_INVARIANT(ch);
            if (hibit) {
                s = bytes_to_utf8(s, &len);
                break;
@@ -532,7 +532,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
                matches++;
                s += UTF8SKIP(s);
                if (uv != puv) {
-                   d = uvuni_to_utf8(d, uv);
+                   d = uvchr_to_utf8(d, uv);
                    puv = uv;
                }
                continue;
@@ -550,13 +550,13 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
                if (havefinal) {
                    s += UTF8SKIP(s);
                    if (puv != final) {
-                       d = uvuni_to_utf8(d, final);
+                       d = uvchr_to_utf8(d, final);
                        puv = final;
                    }
                }
                else {
                    STRLEN len;
-                   uv = utf8n_to_uvuni(s, send - s, &len, UTF8_ALLOW_DEFAULT);
+                   uv = utf8n_to_uvchr(s, send - s, &len, UTF8_ALLOW_DEFAULT);
                    if (uv != puv) {
                        Move(s, d, len, U8);
                        d += len;
@@ -585,7 +585,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
            if (uv < none) {
                matches++;
                s += UTF8SKIP(s);
-               d = uvuni_to_utf8(d, uv);
+               d = uvchr_to_utf8(d, uv);
                continue;
            }
            else if (uv == none) {      /* "none" is unmapped character */
@@ -598,7 +598,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
            else if (uv == extra && !del) {
                matches++;
                s += UTF8SKIP(s);
-               d = uvuni_to_utf8(d, final);
+               d = uvchr_to_utf8(d, final);
                continue;
            }
            matches++;                  /* "none+1" is delete character */
@@ -632,16 +632,13 @@ Perl_do_trans(pTHX_ SV *sv)
     PERL_ARGS_ASSERT_DO_TRANS;
 
     if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL)) {
-        if (SvIsCOW(sv))
-            sv_force_normal_flags(sv, 0);
-        if (SvREADONLY(sv))
-            Perl_croak_no_modify(aTHX);
+            Perl_croak_no_modify();
     }
     (void)SvPV_const(sv, len);
     if (!len)
        return 0;
     if (!(PL_op->op_private & OPpTRANS_IDENTICAL)) {
-       if (!SvPOKp(sv))
+       if (!SvPOKp(sv) || SvTHINKFIRST(sv))
            (void)SvPV_force_nomg(sv, len);
        (void)SvPOK_only_UTF8(sv);
     }
@@ -673,12 +670,12 @@ Perl_do_trans(pTHX_ SV *sv)
 }
 
 void
-Perl_do_join(pTHX_ register SV *sv, SV *delim, register SV **mark, register SV **sp)
+Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp)
 {
     dVAR;
     SV ** const oldmark = mark;
-    register I32 items = sp - mark;
-    register STRLEN len;
+    I32 items = sp - mark;
+    STRLEN len;
     STRLEN delimlen;
 
     PERL_ARGS_ASSERT_DO_JOIN;
@@ -709,7 +706,7 @@ Perl_do_join(pTHX_ register SV *sv, SV *delim, register SV **mark, register SV *
     /* sv_setpv retains old UTF8ness [perl #24846] */
     SvUTF8_off(sv);
 
-    if (PL_tainting && SvMAGICAL(sv))
+    if (TAINTING_get && SvMAGICAL(sv))
        SvTAINTED_off(sv);
 
     if (items-- > 0) {
@@ -914,10 +911,10 @@ void
 Perl_do_vecset(pTHX_ SV *sv)
 {
     dVAR;
-    register SSize_t offset, bitoffs = 0;
-    register int size;
-    register unsigned char *s;
-    register UV lval;
+    SSize_t offset, bitoffs = 0;
+    int size;
+    unsigned char *s;
+    UV lval;
     I32 mask;
     STRLEN targlen;
     STRLEN len;
@@ -1002,16 +999,16 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
 {
     dVAR;
 #ifdef LIBERAL
-    register long *dl;
-    register long *ll;
-    register long *rl;
+    long *dl;
+    long *ll;
+    long *rl;
 #endif
-    register char *dc;
+    char *dc;
     STRLEN leftlen;
     STRLEN rightlen;
-    register const char *lc;
-    register const char *rc;
-    register STRLEN len;
+    const char *lc;
+    const char *rc;
+    STRLEN len;
     STRLEN lensave;
     const char *lsave;
     const char *rsave;
@@ -1232,7 +1229,7 @@ Perl_do_kv(pTHX)
     dVAR;
     dSP;
     HV * const keys = MUTABLE_HV(POPs);
-    register HE *entry;
+    HE *entry;
     const I32 gimme = GIMME_V;
     const I32 dokv =     (PL_op->op_type == OP_RV2HV || PL_op->op_type == OP_PADHV);
     /* op_type is OP_RKEYS/OP_RVALUES if pp_rkeys delegated to here */