Small change to assert macro, added stdlib include

This commit is contained in:
Gitea 2020-12-20 18:43:46 -06:00
parent d96cf1edd8
commit 9ae9826930

View file

@ -12,12 +12,13 @@
#ifndef _ASSERT_H
#define _ASSERT_H
#include <stdlib.h>
#include <stdio.h>
#ifdef NDEBUG
#define assert(ignore) ((void) 0)
#else
#define assert(expression) (expression || (fprintf(stderr, "%s: %d: %s", __FILE__, __LINE__, __func__) && abort()))
#define assert(expression) (expression || (fprintf(stderr, "Assertion failed: %s: %d: %s", __FILE__, __LINE__, __func__) && abort()))
#endif
#endif