This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change to use UVCHR_SKIP over UNI_SKIP
authorKarl Williamson <khw@cpan.org>
Wed, 13 May 2015 23:38:08 +0000 (17:38 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 4 Sep 2015 16:21:17 +0000 (10:21 -0600)
UNI_SKIP is somewhat ambiguous.  Perl has long used 'uvchr' as part of a
name to mean the unsigned values using the native character set plus
Unicode values for those above 255.

This also changes two calls (one in dquote_static.c and one in
dquote_inline.h) to use UVCHR_SKIP; they should not have been OFFUNI, as
they are dealing with native values.

dquote.c
dquote_inline.h
op.c
perl.c
pp.c
regcomp.c
regexec.c
toke.c
utf8.c

index 9d35f20..42864d4 100644 (file)
--- a/dquote.c
+++ b/dquote.c
@@ -160,7 +160,7 @@ Perl_grok_bslash_o(pTHX_ char **s, UV *uv, const char** error_msg,
 
     /* guarantee replacing "\o{...}" with utf8 bytes fits within
      * existing space */
-    assert(OFFUNISKIP(*uv) < *s - start);
+    assert(UVCHR_SKIP(*uv) < *s - start);
 
     return TRUE;
 }
index d8548bf..02c4f1d 100644 (file)
@@ -153,7 +153,7 @@ S_grok_bslash_x(pTHX_ char **s, UV *uv, const char** error_msg,
   ok:
     /* guarantee replacing "\x{...}" with utf8 bytes fits within
      * existing space */
-    assert(OFFUNISKIP(*uv) < *s - start);
+    assert(UVCHR_SKIP(*uv) < *s - start);
     return TRUE;
 }
 
diff --git a/op.c b/op.c
index 72c6809..0163b7a 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5193,7 +5193,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
                    max = rfirst + diff;
                if (!grows)
                    grows = (tfirst < rfirst &&
-                            UNISKIP(tfirst) < UNISKIP(rfirst + diff));
+                            UVCHR_SKIP(tfirst) < UVCHR_SKIP(rfirst + diff));
                rfirst += diff + 1;
            }
            tfirst += diff + 1;
diff --git a/perl.c b/perl.c
index 746a73f..bfce4ef 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3135,10 +3135,10 @@ Perl_moreswitches(pTHX_ const char *s)
                   s--;
              }
              PL_rs = newSVpvs("");
-             SvGROW(PL_rs, (STRLEN)(UNISKIP(rschar) + 1));
+             SvGROW(PL_rs, (STRLEN)(UVCHR_SKIP(rschar) + 1));
              tmps = (U8*)SvPVX(PL_rs);
              uvchr_to_utf8(tmps, rschar);
-             SvCUR_set(PL_rs, UNISKIP(rschar));
+             SvCUR_set(PL_rs, UVCHR_SKIP(rschar));
              SvUTF8_on(PL_rs);
         }
         else {
diff --git a/pp.c b/pp.c
index 5492506..7e5dce1 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2464,7 +2464,7 @@ S_scomplement(pTHX_ SV *targ, SV *sv)
          while (tmps < send) {
            const UV c = utf8n_to_uvchr(tmps, send-tmps, &l, utf8flags);
            tmps += l;
-           targlen += UNISKIP(~c);
+           targlen += UVCHR_SKIP(~c);
            nchar++;
            if (c > 0xff)
                nwide++;
@@ -3578,7 +3578,7 @@ PP(pp_chr)
     SvUPGRADE(TARG,SVt_PV);
 
     if (value > 255 && !IN_BYTES) {
-       SvGROW(TARG, (STRLEN)UNISKIP(value)+1);
+       SvGROW(TARG, (STRLEN)UVCHR_SKIP(value)+1);
        tmps = (char*)uvchr_to_utf8_flags((U8*)SvPVX(TARG), value, 0);
        SvCUR_set(TARG, tmps - SvPVX_const(TARG));
        *tmps = '\0';
index efc6a4b..d4c51e9 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11579,7 +11579,7 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state,
 
     /* A single character node is SIMPLE, except for the special-cased SHARP S
      * under /di. */
-    if ((len == 1 || (UTF && len == UNISKIP(code_point)))
+    if ((len == 1 || (UTF && len == UVCHR_SKIP(code_point)))
 #if    UNICODE_MAJOR_VERSION > 3 /* no multifolds in early Unicode */   \
    || (UNICODE_MAJOR_VERSION == 3 && (   UNICODE_DOT_VERSION > 0)       \
                                       || UNICODE_DOT_DOT_VERSION > 0)
@@ -12635,7 +12635,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
                      * its representation until PASS2. */
                     if (SIZE_ONLY) {
                         if (UTF) {
-                            const STRLEN unilen = UNISKIP(ender);
+                            const STRLEN unilen = UVCHR_SKIP(ender);
                             s += unilen;
 
                             /* We have to subtract 1 just below (and again in
index cb209c8..7d323d5 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1484,7 +1484,7 @@ STMT_START {
         } else {                                                                    \
             uvc = _to_utf8_fold_flags( (const U8*) uc, foldbuf, &foldlen, flags);   \
             len = UTF8SKIP(uc);                                                     \
-            skiplen = UNISKIP( uvc );                                               \
+            skiplen = UVCHR_SKIP( uvc );                                            \
             foldlen -= skiplen;                                                     \
             uscan = foldbuf + skiplen;                                              \
         }                                                                           \
@@ -1501,7 +1501,7 @@ STMT_START {
         } else {                                                                    \
             len = 1;                                                                \
             uvc = _to_fold_latin1( (U8) *uc, foldbuf, &foldlen, flags);             \
-            skiplen = UNISKIP( uvc );                                               \
+            skiplen = UVCHR_SKIP( uvc );                                            \
             foldlen -= skiplen;                                                     \
             uscan = foldbuf + skiplen;                                              \
         }                                                                           \
diff --git a/toke.c b/toke.c
index b341c96..ef208f2 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3227,12 +3227,12 @@ S_scan_const(pTHX_ char *start)
                        *d = '\0';
                        /* See Note on sizing above.  */
                        sv_utf8_upgrade_flags_grow(
-                                         sv,
-                                         SV_GMAGIC|SV_FORCE_UTF8_UPGRADE
+                                       sv,
+                                       SV_GMAGIC|SV_FORCE_UTF8_UPGRADE
                                                   /* Above-latin1 in string
                                                    * implies no encoding */
                                                   |SV_UTF8_NO_ENCODING,
-                                         UNISKIP(uv) + (STRLEN)(send - s) + 1);
+                                       UVCHR_SKIP(uv) + (STRLEN)(send - s) + 1);
                        d = SvPVX(sv) + SvCUR(sv);
                        has_utf8 = TRUE;
                     }
@@ -3362,9 +3362,9 @@ S_scan_const(pTHX_ char *start)
                            *d = '\0';
                            /* See Note on sizing above.  */
                            sv_utf8_upgrade_flags_grow(
-                                       sv,
-                                       SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
-                                       UNISKIP(uv) + (STRLEN)(send - e) + 1);
+                                    sv,
+                                    SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
+                                   UVCHR_SKIP(uv) + (STRLEN)(send - e) + 1);
                            d = SvPVX(sv) + SvCUR(sv);
                            has_utf8 = TRUE;
                        }
@@ -3597,7 +3597,7 @@ S_scan_const(pTHX_ char *start)
            const UV nextuv   = (this_utf8)
                                 ? utf8n_to_uvchr((U8*)s, send - s, &len, 0)
                                 : (UV) ((U8) *s);
-           const STRLEN need = UNISKIP(nextuv);
+           const STRLEN need = UVCHR_SKIP(nextuv);
            if (!has_utf8) {
                SvCUR_set(sv, d - SvPVX_const(sv));
                SvPOK_on(sv);
diff --git a/utf8.c b/utf8.c
index f466f1d..5d4a7ce 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -1831,7 +1831,7 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp,
         }
 
         if (hv
-             && (svp = hv_fetch(hv, (const char*)p, UNISKIP(uv1), FALSE))
+             && (svp = hv_fetch(hv, (const char*)p, UVCHR_SKIP(uv1), FALSE))
              && (*svp))
          {
             const char *s;