Revision cca6d953 libavutil/mem.h
libavutil/mem.h | ||
---|---|---|
48 | 48 |
#define av_malloc_attrib |
49 | 49 |
#endif |
50 | 50 |
|
51 |
#if defined (__GNUC__) && (__GNU__ > 4 || __GNU__ == 4 && __GNU_MINOR__ > 1) |
|
52 |
#define av_alloc_size(n) __attribute__((alloc_size(n))) |
|
53 |
#else |
|
54 |
#define av_alloc_size(n) |
|
55 |
#endif |
|
56 |
|
|
51 | 57 |
/** |
52 | 58 |
* Allocate a block of \p size bytes with alignment suitable for all |
53 | 59 |
* memory accesses (including vectors if available on the CPU). |
... | ... | |
56 | 62 |
* it. |
57 | 63 |
* @see av_mallocz() |
58 | 64 |
*/ |
59 |
void *av_malloc(unsigned int size) av_malloc_attrib; |
|
65 |
void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);
|
|
60 | 66 |
|
61 | 67 |
/** |
62 | 68 |
* Allocate or reallocate a block of memory. |
... | ... | |
70 | 76 |
* reallocate or the function is used to free the memory block. |
71 | 77 |
* @see av_fast_realloc() |
72 | 78 |
*/ |
73 |
void *av_realloc(void *ptr, unsigned int size); |
|
79 |
void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);
|
|
74 | 80 |
|
75 | 81 |
/** |
76 | 82 |
* Free a memory block which has been allocated with av_malloc(z)() or |
... | ... | |
91 | 97 |
* it. |
92 | 98 |
* @see av_malloc() |
93 | 99 |
*/ |
94 |
void *av_mallocz(unsigned int size) av_malloc_attrib; |
|
100 |
void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);
|
|
95 | 101 |
|
96 | 102 |
/** |
97 | 103 |
* Duplicate the string \p s. |
Also available in: Unified diff