#ifndef _AVUTIL_AVASSERT_H_b9e8c52a_ #define _AVUTIL_AVASSERT_H_b9e8c52a_ /* * This file was stolen from ffmpeg and modified for usability here. * The original is * * copyright (c) 2010 Michael Niedermayer * * This version is a derivative work of that version. It is not free * software; it is licensed under the GNU Lesser General Public * License version 2.1, which places nontrivial restrictions on what * may be done with it. (I'm not terribly happy about that, but for * my purposes accepting LGPL-infected code is a lower price than * reimplementing it all myself.) * * The LGPL v2.1 as distributed with ffmpeg is in the accompanying file * `LGPL-v2.1'. */ #if 0 #include #include "avutil.h" #include "log.h" #endif /** * assert() equivalent, that is always enabled. */ #define av_assert0(cond) do { \ if (!(cond)) { \ av_log(0, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ AV_STRINGIFY(cond), __FILE__, __LINE__); \ abort(); \ } \ } while (0) /** * assert() equivalent, that does not lie in speed critical code. * These asserts() thus can be enabled without fearing speedloss. */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 #define av_assert1(cond) av_assert0(cond) #else #define av_assert1(cond) ((void)0) #endif /** * assert() equivalent, that does lie in speed critical code. */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 #define av_assert2(cond) av_assert0(cond) #else #define av_assert2(cond) ((void)0) #endif #endif