This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_pack.c: Silence compiler warning
authorKarl Williamson <khw@cpan.org>
Fri, 20 Feb 2015 16:27:16 +0000 (09:27 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 20 Feb 2015 16:50:22 +0000 (09:50 -0700)
This was introduced by 9df874cdaa2f196cc11fbd7b82a85690c243eb9f
in changing the name of some static functions.  I didn't realize at the
time that the function was defined in embed.fnc, as none of the others
are, and it was always called with the S_ prefix form.  Nor did I notice
the compiler warnings.

It turns out that the base name of this function is the same as a public
function, so I've renamed it to have prefix 'S_my_'.

embed.fnc
embed.h
pp_pack.c
proto.h

index 5aa11c7..26d3511 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2030,7 +2030,7 @@ sR        |const char *|get_num   |NN const char *patptr|NN I32 *lenptr
 ns     |bool   |need_utf8      |NN const char *pat|NN const char *patend
 ns     |char   |first_symbol   |NN const char *pat|NN const char *patend
 sR     |char * |sv_exp_grow    |NN SV *sv|STRLEN needed
-snR    |char * |bytes_to_uni   |NN const U8 *start|STRLEN len|NN char *dest \
+snR    |char * |my_bytes_to_utf8|NN const U8 *start|STRLEN len|NN char *dest \
                                |const bool needs_swap
 #endif
 
diff --git a/embed.h b/embed.h
index 58b116b..77b867c 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define opmethod_stash(a)      S_opmethod_stash(aTHX_ a)
 #  endif
 #  if defined(PERL_IN_PP_PACK_C)
-#define bytes_to_uni           S_bytes_to_uni
 #define div128(a,b)            S_div128(aTHX_ a,b)
 #define first_symbol           S_first_symbol
 #define get_num(a,b)           S_get_num(aTHX_ a,b)
 #define is_an_int(a,b)         S_is_an_int(aTHX_ a,b)
 #define measure_struct(a)      S_measure_struct(aTHX_ a)
 #define mul128(a,b)            S_mul128(aTHX_ a,b)
+#define my_bytes_to_utf8       S_my_bytes_to_utf8
 #define need_utf8              S_need_utf8
 #define next_symbol(a)         S_next_symbol(aTHX_ a)
 #define pack_rec(a,b,c,d)      S_pack_rec(aTHX_ a,b,c,d)
index 0cbe3c4..2d1a208 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -327,8 +327,8 @@ S_utf8_to_bytes(pTHX_ const char **s, const char *end, const char *buf, int buf_
 }
 
 STATIC char *
-S_bytes_to_utf8(const U8 *start, STRLEN len, char *dest, const bool needs_swap) {
-    PERL_ARGS_ASSERT_BYTES_TO_UNI;
+S_my_bytes_to_utf8(const U8 *start, STRLEN len, char *dest, const bool needs_swap) {
+    PERL_ARGS_ASSERT_MY_BYTES_TO_UTF8;
 
     if (UNLIKELY(needs_swap)) {
         const U8 *p = start + len;
@@ -348,7 +348,7 @@ S_bytes_to_utf8(const U8 *start, STRLEN len, char *dest, const bool needs_swap)
 #define PUSH_BYTES(utf8, cur, buf, len, needs_swap)             \
 STMT_START {                                                   \
     if (UNLIKELY(utf8))                                                \
-       (cur) = S_bytes_to_utf8((U8 *) buf, len, (cur), needs_swap);       \
+       (cur) = my_bytes_to_utf8((U8 *) buf, len, (cur), needs_swap);       \
     else {                                                     \
         if (UNLIKELY(needs_swap))                               \
             S_reverse_copy((char *)(buf), cur, len);            \
@@ -386,7 +386,7 @@ STMT_START {                                        \
 STMT_START {                                   \
     if (utf8) {                                        \
        const U8 au8 = (byte);                  \
-       (s) = S_bytes_to_utf8(&au8, 1, (s), 0); \
+       (s) = my_bytes_to_utf8(&au8, 1, (s), 0);\
     } else *(U8 *)(s)++ = (byte);              \
 } STMT_END
 
@@ -2640,7 +2640,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
                                len+(endb-buffer)*UTF8_EXPAND);
                        end = start+SvLEN(cat);
                    }
-                    cur = S_bytes_to_utf8(buffer, endb-buffer, cur, 0);
+                    cur = my_bytes_to_utf8(buffer, endb-buffer, cur, 0);
                } else {
                    if (cur >= end) {
                        *cur = '\0';
diff --git a/proto.h b/proto.h
index 089114f..a8803b0 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -6704,13 +6704,6 @@ PERL_STATIC_INLINE HV*   S_opmethod_stash(pTHX_ SV* meth)
 
 #endif
 #if defined(PERL_IN_PP_PACK_C)
-STATIC char *  S_bytes_to_uni(const U8 *start, STRLEN len, char *dest, const bool needs_swap)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(3);
-#define PERL_ARGS_ASSERT_BYTES_TO_UNI  \
-       assert(start); assert(dest)
-
 STATIC int     S_div128(pTHX_ SV *pnum, bool *done)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
@@ -6752,6 +6745,13 @@ STATIC SV*       S_mul128(pTHX_ SV *sv, U8 m)
 #define PERL_ARGS_ASSERT_MUL128        \
        assert(sv)
 
+STATIC char *  S_my_bytes_to_utf8(const U8 *start, STRLEN len, char *dest, const bool needs_swap)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(1)
+                       __attribute__nonnull__(3);
+#define PERL_ARGS_ASSERT_MY_BYTES_TO_UTF8      \
+       assert(start); assert(dest)
+
 STATIC bool    S_need_utf8(const char *pat, const char *patend)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2);