#define FFMPEG_MEM_H
#ifdef __ICC
- #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
- #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
-#elif __GNUC__
- #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
- #define DECLARE_ASM_CONST(n,t,v) static const t v attribute_used __attribute__ ((aligned (n)))
-#elif _MSVC
- #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
- #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+ #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
+ #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
+#elif defined(__GNUC__)
+ #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
+ #define DECLARE_ASM_CONST(n,t,v) static const t v attribute_used __attribute__ ((aligned (n)))
+#elif defined(_MSC_VER)
+ #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+#elif defined(HAVE_INLINE_ASM)
+ #error The asm code needs alignment, but we do not know how to do it for this compiler.
+#else
+ #define DECLARE_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_CONST(n,t,v) static const t v
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
+ #define av_malloc_attrib __attribute__((__malloc__))
+#else
+ #define av_malloc_attrib
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2)
+ #define av_alloc_size(n) __attribute__((alloc_size(n)))
+#else
+ #define av_alloc_size(n)
#endif
/**
* it.
* @see av_mallocz()
*/
-void *av_malloc(unsigned int size);
+void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);
/**
* Allocate or reallocate a block of memory.
* reallocate or the function is used to free the memory block.
* @see av_fast_realloc()
*/
-void *av_realloc(void *ptr, unsigned int size);
+void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);
/**
* Free a memory block which has been allocated with av_malloc(z)() or
* it.
* @see av_malloc()
*/
-void *av_mallocz(unsigned int size);
+void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);
/**
* Duplicate the string \p s.
* @return Pointer to a newly allocated string containing a
* copy of \p s or NULL if it cannot be allocated.
*/
-char *av_strdup(const char *s);
+char *av_strdup(const char *s) av_malloc_attrib;
/**
* Free a memory block which has been allocated with av_malloc(z)() or