diff options
author | Sven Gothel <[email protected]> | 2013-08-27 23:38:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-08-27 23:38:51 +0200 |
commit | 70fb61d39f4e40de62dd44b2d8c88d43b9efaf42 (patch) | |
tree | 846bd404cae673b19f4a07f051e483bc58d6189b /make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h | |
parent | b7e1dcb2b510c91a0e61bea12d0fc153878f894a (diff) |
Fix libav/ffmpeg compilation across platforms: Move header back to 'stub_includes'
Diffstat (limited to 'make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h')
-rw-r--r-- | make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h b/make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h new file mode 100644 index 000000000..b223d26e8 --- /dev/null +++ b/make/stub_includes/libav/lavc54.lavf54.lavu52.lavr01/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer <[email protected]> + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include <stdlib.h> +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, 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 /* AVUTIL_AVASSERT_H */ |