mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Add local assert function to avoid problems with memory allocation in
the real one.
This commit is contained in:
@@ -329,7 +329,29 @@ extern "C" {
|
|||||||
or other mallocs available that do this.
|
or other mallocs available that do this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#ifdef NDEBUG
|
||||||
|
# define assert(expr) ((void) 0)
|
||||||
|
#else
|
||||||
|
# define assert(expr) \
|
||||||
|
((expr) \
|
||||||
|
? ((void) 0) \
|
||||||
|
: __malloc_assert (__STRING (expr), __FILE__, __LINE__, __func__))
|
||||||
|
|
||||||
|
extern const char *__progname;
|
||||||
|
|
||||||
|
static void
|
||||||
|
__malloc_assert (const char *assertion, const char *file, unsigned int line,
|
||||||
|
const char *function)
|
||||||
|
{
|
||||||
|
(void) __fxprintf (NULL, "%s%s%s:%u: %s%sAssertion `%s' failed.\n",
|
||||||
|
__progname, __progname[0] ? ": " : "",
|
||||||
|
file, line,
|
||||||
|
function ? function : "", function ? ": " : "",
|
||||||
|
assertion);
|
||||||
|
fflush (stderr);
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user