This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Static fnc always passed non-null
authorKarl Williamson <khw@cpan.org>
Wed, 11 Jul 2018 13:25:38 +0000 (07:25 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 11 Jul 2018 14:08:11 +0000 (08:08 -0600)
This function was inconsistent until this commit, setting a a value
unconditionally in all but one place.

embed.fnc
proto.h
utf8.c

index 0897eff..f289069 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1781,7 +1781,7 @@ s |U32    |check_and_deprecate                                        \
 s      |UV     |_to_utf8_case  |const UV uv1                                   \
                                |NN const U8 *p                                 \
                                |NN U8* ustrp                                   \
-                               |NULLOK STRLEN *lenp                            \
+                               |NN STRLEN *lenp                                \
                                |NN SV *invlist                                 \
                                |NN const int * const invmap                    \
                                |NULLOK const unsigned int * const * const aux_tables   \
diff --git a/proto.h b/proto.h
index 657f2d4..d091961 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5951,7 +5951,7 @@ STATIC bool       S_isa_lookup(pTHX_ HV *stash, const char * const name, STRLEN len, U
 #if defined(PERL_IN_UTF8_C)
 STATIC UV      S__to_utf8_case(pTHX_ const UV uv1, const U8 *p, U8* ustrp, STRLEN *lenp, SV *invlist, const int * const invmap, const unsigned int * const * const aux_tables, const U8 * const aux_table_lengths, const char * const normal);
 #define PERL_ARGS_ASSERT__TO_UTF8_CASE \
-       assert(p); assert(ustrp); assert(invlist); assert(invmap); assert(normal)
+       assert(p); assert(ustrp); assert(lenp); assert(invlist); assert(invmap); assert(normal)
 STATIC U32     S_check_and_deprecate(pTHX_ const U8 * p, const U8 ** e, const unsigned type, const bool use_locale, const char * const file, const unsigned line);
 #define PERL_ARGS_ASSERT_CHECK_AND_DEPRECATE   \
        assert(p); assert(e); assert(file)
diff --git a/utf8.c b/utf8.c
index 5ca462e..bdbe23f 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -3537,8 +3537,7 @@ S__to_utf8_case(pTHX_ const UV uv1, const U8 *p,
         Copy(p, ustrp, len, U8);
     }
 
-    if (lenp)
-        *lenp = len;
+    *lenp = len;
 
     return uv1;