In assert(), we mustn't stringify the message as part of the first
Nicholas Clark [Fri, 27 May 2005 18:54:36 +0000 (18:54 +0000)]
argument to croak, as it's a *printf format, and the thing we're
asserting might itself contain % signs.
Also, as __FILE__ is a string, we can append that to the format,
rather than needing a %s for it.

p4raw-id: //depot/perl@24609

perl.h

diff --git a/perl.h b/perl.h
index 9aaf7b4..7688d96 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3191,8 +3191,8 @@ Gid_t getegid (void);
 #ifndef assert  /* <assert.h> might have been included somehow */
 #define assert(what)   PERL_DEB(                                       \
        ((what) ? ((void) 0) :                                          \
-           (Perl_croak(aTHX_ "Assertion " STRINGIFY(what) " failed: file \"%s\", line %d",     \
-               __FILE__, __LINE__),                                    \
+           (Perl_croak(aTHX_ "Assertion %s failed: file \"" __FILE__   \
+                       "\", line %d", STRINGIFY(what), __LINE__),      \
            PerlProc_exit(1),                                           \
            (void) 0)))
 #endif