/*1* copyright (c) 2010 Michael Niedermayer <[email protected]>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920/**21* @file22* simple assert() macros that are a bit more flexible than ISO C assert().23* @author Michael Niedermayer <[email protected]>24*/2526#ifndef AVUTIL_AVASSERT_H27#define AVUTIL_AVASSERT_H2829#include <stdlib.h>30#include "avutil.h"31#include "log.h"3233/**34* assert() equivalent, that is always enabled.35*/36#define av_assert0(cond) do { \37if (!(cond)) { \38av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \39AV_STRINGIFY(cond), __FILE__, __LINE__); \40abort(); \41} \42} while (0)434445/**46* assert() equivalent, that does not lie in speed critical code.47* These asserts() thus can be enabled without fearing speedloss.48*/49#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 050#define av_assert1(cond) av_assert0(cond)51#else52#define av_assert1(cond) ((void)0)53#endif545556/**57* assert() equivalent, that does lie in speed critical code.58*/59#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 160#define av_assert2(cond) av_assert0(cond)61#else62#define av_assert2(cond) ((void)0)63#endif6465#endif /* AVUTIL_AVASSERT_H */666768