This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Add void * casts to memEQ, memNE
[perl5.git] / mathoms.c
index 80bc35d..8b003d3 100644 (file)
--- a/mathoms.c
+++ b/mathoms.c
@@ -518,7 +518,7 @@ int
 Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
 {
     int ret = 0;
-    va_list(arglist);
+    va_list arglist;
 
     /* Easier to special case this here than in embed.pl. (Look at what it
        generates for proto.h) */
@@ -536,7 +536,7 @@ int
 Perl_printf_nocontext(const char *format, ...)
 {
     dTHX;
-    va_list(arglist);
+    va_list arglist;
     int ret = 0;
 
 #ifdef PERL_IMPLICIT_CONTEXT
@@ -1081,6 +1081,7 @@ Perl_sv_eq(pTHX_ SV *sv1, SV *sv2)
 char *
 Perl_sv_collxfrm(pTHX_ SV *const sv, STRLEN *const nxp)
 {
+    PERL_ARGS_ASSERT_SV_COLLXFRM;
     return sv_collxfrm_flags(sv, nxp, SV_GMAGIC);
 }
 
@@ -1100,6 +1101,7 @@ Perl_mem_collxfrm(pTHX_ const char *input_string, STRLEN len, STRLEN *xlen)
 bool
 Perl_sv_2bool(pTHX_ SV *const sv)
 {
+    PERL_ARGS_ASSERT_SV_2BOOL;
     return sv_2bool_flags(sv, SV_GMAGIC);
 }
 
@@ -1658,8 +1660,9 @@ Perl_is_utf8_char(const U8 *s)
 {
     PERL_ARGS_ASSERT_IS_UTF8_CHAR;
 
-    /* Assumes we have enough space, which is why this is deprecated */
-    return isUTF8_CHAR(s, s + UTF8SKIP(s));
+    /* Assumes we have enough space, which is why this is deprecated.  But the
+     * strnlen() makes it safe for the common case of NUL-terminated strings */
+    return isUTF8_CHAR(s, s + my_strnlen((char *) s, UTF8SKIP(s)));
 }
 
 /*