Libav 0.7.1
|
00001 /* 00002 * copyright (c) 2010 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of Libav. 00005 * 00006 * Libav is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * Libav is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with Libav; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 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 /* AVUTIL_AVASSERT_H */