This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Use better method for setting debug offsets
[perl5.git] / perlio.c
index f5eb485..904d47a 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -371,7 +371,19 @@ PerlIO_debug(const char *fmt, ...)
        /* Use fixed buffer as sv_catpvf etc. needs SVs */
        char buffer[1024];
        const STRLEN len1 = my_snprintf(buffer, sizeof(buffer), "%.40s:%" IVdf " ", s ? s : "(none)", (IV) CopLINE(PL_curcop));
+#  ifdef USE_QUADMATH
+#    ifdef HAS_VSNPRINTF
+        /* my_vsnprintf() isn't available with quadmath, but the native vsnprintf()
+           should be, otherwise the system isn't likely to support quadmath.
+           Nothing should be calling PerlIO_debug() with floating point anyway.
+        */
+        const STRLEN len2 = vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
+#    else
+        STATIC_ASSERT_STMT(0);
+#    endif
+#  else
        const STRLEN len2 = my_vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
+#  endif
        PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2));
 #else
        const char *s = CopFILE(PL_curcop);
@@ -4813,7 +4825,7 @@ PerlIOCrlf_binmode(pTHX_ PerlIO *f)
        PerlIO_pop(aTHX_ f);
 #endif
     }
-    return 0;
+    return PerlIOBase_binmode(aTHX_ f);
 }
 
 PERLIO_FUNCS_DECL(PerlIO_crlf) = {
@@ -5231,7 +5243,7 @@ PerlIO_getpos(PerlIO *f, SV *pos)
 void
 Perl_noperl_die(const char* pat, ...)
 {
-    va_list(arglist);
+    va_list arglist;
     PERL_ARGS_ASSERT_NOPERL_DIE;
     va_start(arglist, pat);
     vfprintf(stderr, pat, arglist);