00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00027 #ifndef AVUTIL_AVASSERT_H
00028 #define AVUTIL_AVASSERT_H
00029 
00030 #include <stdlib.h>
00031 #include "avutil.h"
00032 #include "log.h"
00033 
00037 #define av_assert0(cond) do {                                           \
00038     if (!(cond)) {                                                      \
00039         av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n",    \
00040                AV_STRINGIFY(cond), __FILE__, __LINE__);                 \
00041         abort();                                                        \
00042     }                                                                   \
00043 } while (0)
00044 
00045 
00050 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
00051 #define av_assert1(cond) av_assert0(cond)
00052 #else
00053 #define av_assert1(cond) ((void)0)
00054 #endif
00055 
00056 
00060 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
00061 #define av_assert2(cond) av_assert0(cond)
00062 #else
00063 #define av_assert2(cond) ((void)0)
00064 #endif
00065 
00066 #endif