Revision 0ee97f0d libavutil/mem.h
libavutil/mem.h | ||
---|---|---|
33 | 33 |
#endif |
34 | 34 |
|
35 | 35 |
/** |
36 |
* Memory allocation of size bytes with alignment suitable for all |
|
37 |
* memory accesses (including vectors if available on the |
|
38 |
* CPU). av_malloc(0) must return a non-NULL pointer. |
|
36 |
* Allocate a block of \p size bytes with alignment suitable for all |
|
37 |
* memory accesses (including vectors if available on the CPU). |
|
38 |
* @param size Size in bytes for the memory block to be allocated. |
|
39 |
* @return Pointer to the allocated block, NULL if it cannot allocate |
|
40 |
* it. |
|
41 |
* @see av_mallocz() |
|
39 | 42 |
*/ |
40 | 43 |
void *av_malloc(unsigned int size); |
41 | 44 |
|
42 | 45 |
/** |
43 |
* av_realloc semantics (same as glibc): If ptr is NULL and size > 0, |
|
44 |
* identical to malloc(size). If size is zero, it is identical to |
|
45 |
* free(ptr) and NULL is returned. |
|
46 |
* Allocate or reallocate a block of memory. |
|
47 |
* If \p ptr is NULL and \p size > 0, allocate a new block. If \p |
|
48 |
* size is zero, free the memory block pointed by \p ptr. |
|
49 |
* @param size Size in bytes for the memory block to be allocated or |
|
50 |
* reallocated. |
|
51 |
* @param ptr Pointer to a memory block already allocated with |
|
52 |
* av_malloc(z)() or av_realloc() or NULL. |
|
53 |
* @return Pointer to a newly reallocated block or NULL if it cannot |
|
54 |
* reallocate or the function is used to free the memory block. |
|
55 |
* @see av_fast_realloc() |
|
46 | 56 |
*/ |
47 | 57 |
void *av_realloc(void *ptr, unsigned int size); |
48 | 58 |
|
49 | 59 |
/** |
50 |
* Free memory which has been allocated with av_malloc(z)() or av_realloc(). |
|
60 |
* Free a memory block which has been allocated with av_malloc(z)() or |
|
61 |
* av_realloc(). |
|
62 |
* @param ptr Pointer to the memory block which should be freed. |
|
51 | 63 |
* @note ptr = NULL is explicitly allowed. |
52 | 64 |
* @note It is recommended that you use av_freep() instead. |
65 |
* @see av_freep() |
|
53 | 66 |
*/ |
54 | 67 |
void av_free(void *ptr); |
55 | 68 |
|
69 |
/** |
|
70 |
* Allocate a block of \p size bytes with alignment suitable for all |
|
71 |
* memory accesses (including vectors if available on the CPU) and |
|
72 |
* set to zeroes all the bytes of the block. |
|
73 |
* @param size Size in bytes for the memory block to be allocated. |
|
74 |
* @return Pointer to the allocated block, NULL if it cannot allocate |
|
75 |
* it. |
|
76 |
* @see av_malloc() |
|
77 |
*/ |
|
56 | 78 |
void *av_mallocz(unsigned int size); |
57 | 79 |
|
58 | 80 |
/** |
... | ... | |
64 | 86 |
char *av_strdup(const char *s); |
65 | 87 |
|
66 | 88 |
/** |
67 |
* Free memory and set the pointer to NULL. |
|
68 |
* @param ptr Pointer to the pointer which should be freed. |
|
89 |
* Free a memory block which has been allocated with av_malloc(z)() or |
|
90 |
* av_realloc() and set to NULL the pointer to it. |
|
91 |
* @param ptr Pointer to the pointer to the memory block which should |
|
92 |
* be freed. |
|
93 |
* @see av_free() |
|
69 | 94 |
*/ |
70 | 95 |
void av_freep(void *ptr); |
71 | 96 |
|
Also available in: Unified diff