Loading...
Searching...
No Matches
Function Attributes
libavutil » Memory Management

Function attributes applicable to memory handling functions. More...

## Macros

#define | av_malloc_attrib __attribute__((__malloc__))
| Function attribute denoting a malloc-like function.
#define | av_alloc_size(...)
| Function attribute used on a function that allocates memory, whose size is given by the specified parameter(s).

## Detailed Description

Function attributes applicable to memory handling functions.

These function attributes can help compilers emit more useful warnings, or generate better code.

## Macro Definition Documentation

## av_malloc_attrib

#define av_malloc_attrib __attribute__((__malloc__))

Function attribute denoting a malloc-like function.

See also
  Function attribute malloc in GCC's documentation

Definition at line 69 of file mem.h.

Referenced by av_calloc(), av_malloc(), av_mallocz(), av_strdup(), and av_strndup().

## av_alloc_size

#define av_alloc_size | ( |  | ... | ) |

Value:
__attribute__((alloc_size(__VA_ARGS__)))

Function attribute used on a function that allocates memory, whose size is given by the specified parameter(s).

void *av_malloc(size_t size) av_alloc_size(1);
void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
av_alloc_size
#define av_alloc_size(...)
Function attribute used on a function that allocates memory, whose size is given by the specified par...
Definition mem.h:90
av_malloc
void * av_malloc(size_t size) av_malloc_attrib
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
av_calloc
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Allocate a memory block for an array with av_mallocz().

Parameters

  ... | One or two parameter indexes, separated by a comma

See also
  Function attribute alloc_size in GCC's documentation

Definition at line 90 of file mem.h.

Referenced by av_calloc(), av_realloc(), and av_realloc_array().