This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Move static function to embed.fnc
authorKarl Williamson <khw@cpan.org>
Fri, 30 May 2014 00:41:58 +0000 (18:41 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 30 May 2014 00:58:20 +0000 (18:58 -0600)
This automatically generates assertions for pointer arguments, etc.

embed.fnc
embed.h
proto.h
utf8.c

index 6853ebc..6fe5daa 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2396,6 +2396,9 @@ iRn       |STRLEN |is_utf8_char_slow|NN const U8 *s|const STRLEN len
 sRM    |UV     |check_locale_boundary_crossing|NN const U8* const p|const UV result|NN U8* const ustrp|NN STRLEN *lenp
 iR     |bool   |is_utf8_common |NN const U8 *const p|NN SV **swash|NN const char * const swashname|NULLOK SV* const invlist
 sR     |SV*    |swatch_get     |NN SV* swash|UV start|UV span
+sRM    |U8*    |swash_scan_list_line|NN U8* l|NN U8* const lend|NN UV* min \
+               |NN UV* max|NN UV* val|const bool wants_value               \
+               |NN const U8* const typestr
 #endif
 
 AiMn   |void   |append_utf8_from_native_byte|const U8 byte|NN U8** dest
diff --git a/embed.h b/embed.h
index 554fea3..68e00ea 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define check_locale_boundary_crossing(a,b,c,d)        S_check_locale_boundary_crossing(aTHX_ a,b,c,d)
 #define is_utf8_char_slow      S_is_utf8_char_slow
 #define is_utf8_common(a,b,c,d)        S_is_utf8_common(aTHX_ a,b,c,d)
+#define swash_scan_list_line(a,b,c,d,e,f,g)    S_swash_scan_list_line(aTHX_ a,b,c,d,e,f,g)
 #define swatch_get(a,b,c)      S_swatch_get(aTHX_ a,b,c)
 #define to_lower_latin1(a,b,c) S_to_lower_latin1(aTHX_ a,b,c)
 #  endif
diff --git a/proto.h b/proto.h
index 140d7f3..a8a0e5a 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -7705,6 +7705,17 @@ PERL_STATIC_INLINE bool  S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, co
 #define PERL_ARGS_ASSERT_IS_UTF8_COMMON        \
        assert(p); assert(swash); assert(swashname)
 
+STATIC U8*     S_swash_scan_list_line(pTHX_ U8* l, U8* const lend, UV* min, UV* max, UV* val, const bool wants_value, const U8* const typestr)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4)
+                       __attribute__nonnull__(pTHX_5)
+                       __attribute__nonnull__(pTHX_7);
+#define PERL_ARGS_ASSERT_SWASH_SCAN_LIST_LINE  \
+       assert(l); assert(lend); assert(min); assert(max); assert(val); assert(typestr)
+
 STATIC SV*     S_swatch_get(pTHX_ SV* swash, UV start, UV span)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
diff --git a/utf8.c b/utf8.c
index 5d1b05a..36ee737 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2992,6 +2992,8 @@ S_swash_scan_list_line(pTHX_ U8* l, U8* const lend, UV* min, UV* max, UV* val,
     /* nl points to the next \n in the scan */
     U8* const nl = (U8*)memchr(l, '\n', lend - l);
 
+    PERL_ARGS_ASSERT_SWASH_SCAN_LIST_LINE;
+
     /* Get the first number on the line: the range minimum */
     numlen = lend - l;
     *min = grok_hex((char *)l, &numlen, &flags, NULL);
@@ -3161,8 +3163,8 @@ S_swatch_get(pTHX_ SV* swash, UV start, UV span)
     lend = l + lcur;
     while (l < lend) {
        UV min, max, val, upper;
-       l = S_swash_scan_list_line(aTHX_ l, lend, &min, &max, &val,
-                                        cBOOL(octets), typestr);
+       l = swash_scan_list_line(l, lend, &min, &max, &val,
+                                                        cBOOL(octets), typestr);
        if (l > lend) {
            break;
        }
@@ -3573,8 +3575,8 @@ Perl__swash_inversion_hash(pTHX_ SV* const swash)
     while (l < lend) {
        UV min, max, val;
        UV inverse;
-       l = S_swash_scan_list_line(aTHX_ l, lend, &min, &max, &val,
-                                        cBOOL(octets), typestr);
+       l = swash_scan_list_line(l, lend, &min, &max, &val,
+                                                     cBOOL(octets), typestr);
        if (l > lend) {
            break;
        }
@@ -3772,8 +3774,8 @@ Perl__swash_to_invlist(pTHX_ SV* const swash)
             UV start, end;
             UV val;            /* Not used by this function */
 
-            l = S_swash_scan_list_line(aTHX_ l, lend, &start, &end, &val,
-                                            cBOOL(octets), typestr);
+            l = swash_scan_list_line(l, lend, &start, &end, &val,
+                                                        cBOOL(octets), typestr);
 
             if (l > lend) {
                 break;