Macros | Typedefs | Functions
Lazy allocator

Macros

#define EINA_LALLOC_ALLOC(function)   ((Eina_Lalloc_Alloc)function)
 
#define EINA_LALLOC_FREE(function)   ((Eina_Lalloc_Free)function)
 

Typedefs

typedef Eina_Bool(* Eina_Lalloc_Alloc) (void *user_data, int num)
 Type definition for the callback used to allocate new items in a lazy allocator.
 
typedef void(* Eina_Lalloc_Free) (void *user_data)
 Type definition for the callback used to allocate new items in a lazy allocator.
 
typedef struct _Eina_Lalloc Eina_Lalloc
 Public type definition for a lazy allocator.
 

Functions

EAPI Eina_Lalloceina_lalloc_new (void *data, Eina_Lalloc_Alloc alloc_cb, Eina_Lalloc_Free free_cb, int num_init) EINA_ARG_NONNULL(2
 Creates a new lazy allocator. More...
 
EAPI void eina_lalloc_free (Eina_Lalloc *a) EINA_ARG_NONNULL(1)
 Frees the resources for a lazy allocator. More...
 
EAPI Eina_Bool eina_lalloc_element_add (Eina_Lalloc *a) EINA_ARG_NONNULL(1)
 Allocates one more of whatever the lazy allocator is allocating. More...
 
EAPI Eina_Bool eina_lalloc_elements_add (Eina_Lalloc *a, int num) EINA_ARG_NONNULL(1)
 Adds several elements to a lazy allocator. More...
 

Detailed Description

Macro Definition Documentation

◆ EINA_LALLOC_ALLOC

#define EINA_LALLOC_ALLOC (   function)    ((Eina_Lalloc_Alloc)function)
Parameters
[in]functionThe function to allocate.

◆ EINA_LALLOC_FREE

#define EINA_LALLOC_FREE (   function)    ((Eina_Lalloc_Free)function)
Parameters
[in]functionThe function to free.

Function Documentation

◆ eina_lalloc_new()

EAPI Eina_Lalloc * eina_lalloc_new ( void *  data,
Eina_Lalloc_Alloc  alloc_cb,
Eina_Lalloc_Free  free_cb,
int  num_init 
)

Creates a new lazy allocator.

Parameters
[in]dataThe data for which memory will be allocated.
[in]alloc_cbThe callback to allocate memory for data items.
[in]free_cbThe callback to free memory for data items.
[in]num_initThe number of data items to initially allocate space for.
Returns
A new lazy allocator.

◆ eina_lalloc_free()

EAPI Eina_Lalloc EAPI void eina_lalloc_free ( Eina_Lalloc a)

Frees the resources for a lazy allocator.

Parameters
[in,out]aThe lazy allocator to free.

◆ eina_lalloc_element_add()

EAPI Eina_Bool eina_lalloc_element_add ( Eina_Lalloc a)

Allocates one more of whatever the lazy allocator is allocating.

Parameters
[in,out]aThe lazy allocator to add an item to.
Returns
EINA_TRUE on success, else EINA_FALSE.

◆ eina_lalloc_elements_add()

EAPI Eina_Bool eina_lalloc_elements_add ( Eina_Lalloc a,
int  num 
)

Adds several elements to a lazy allocator.

Parameters
[in,out]aThe lazy allocator to add items to.
[in]numThe number of elements to add.
Returns
EINA_TRUE on success, else EINA_FALSE.