Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef AVUTIL_MEM_H
00027 #define AVUTIL_MEM_H
00028
00029 #include "attributes.h"
00030 #include "avutil.h"
00031
00038 #if defined(__ICC) && _ICC < 1200 || defined(__SUNPRO_C)
00039 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
00040 #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
00041 #elif defined(__TI_COMPILER_VERSION__)
00042 #define DECLARE_ALIGNED(n,t,v) \
00043 AV_PRAGMA(DATA_ALIGN(v,n)) \
00044 t __attribute__((aligned(n))) v
00045 #define DECLARE_ASM_CONST(n,t,v) \
00046 AV_PRAGMA(DATA_ALIGN(v,n)) \
00047 static const t __attribute__((aligned(n))) v
00048 #elif defined(__GNUC__)
00049 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
00050 #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
00051 #elif defined(_MSC_VER)
00052 #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
00053 #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
00054 #else
00055 #define DECLARE_ALIGNED(n,t,v) t v
00056 #define DECLARE_ASM_CONST(n,t,v) static const t v
00057 #endif
00058
00059 #if AV_GCC_VERSION_AT_LEAST(3,1)
00060 #define av_malloc_attrib __attribute__((__malloc__))
00061 #else
00062 #define av_malloc_attrib
00063 #endif
00064
00065 #if AV_GCC_VERSION_AT_LEAST(4,3)
00066 #define av_alloc_size(n) __attribute__((alloc_size(n)))
00067 #else
00068 #define av_alloc_size(n)
00069 #endif
00070
00079 void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
00080
00093 void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
00094
00103 void av_free(void *ptr);
00104
00113 void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
00114
00121 char *av_strdup(const char *s) av_malloc_attrib;
00122
00130 void av_freep(void *ptr);
00131
00136 #endif