Tizen Native API
|
Functions | |
static void | eina_trash_init (Eina_Trash **trash) |
Initialize a trash before using it. | |
static void | eina_trash_push (Eina_Trash **trash, void *data) |
Push an unused pointer in the trash instead of freeing it. | |
static void * | eina_trash_pop (Eina_Trash **trash) |
Pop an available pointer from the trash if possible. | |
Typedefs | |
typedef struct _Eina_Trash | Eina_Trash |
The structure type for a generic container of an unused allocated pointer. | |
Defines | |
#define | EINA_TRASH_CLEAN(trash, data) while ((data = eina_trash_pop(trash))) |
Definition of a macro to remove all the pointers from the trash. |
This group provides a generic container.
#define EINA_TRASH_CLEAN | ( | trash, | |
data | |||
) | while ((data = eina_trash_pop(trash))) |
Definition of a macro to remove all the pointers from the trash.
This macro allows the cleaning of trash in an easy way. It removes all the pointers from trash until it's empty.
Eina_Trash *trash = NULL; char *data; // trash is filled with a pointer to some duped strings. EINA_TRASH_CLEAN(&trash, data) free(data);
trash | The trash to clean |
data | The pointer extracted from the trash |
static void eina_trash_init | ( | Eina_Trash ** | trash | ) | [static] |
Initialize a trash before using it.
This function just set to zero the trash to correctly initialize it.
NULL
and you will have the same result.[in] | trash | The trash. |
static void* eina_trash_pop | ( | Eina_Trash ** | trash | ) | [static] |
Pop an available pointer from the trash if possible.
Instead of calling malloc, and putting pressure on malloc/free you can recycle the content of the trash, if it's not empty.
[in] | trash | A pointer to an Eina_Trash. |
static void eina_trash_push | ( | Eina_Trash ** | trash, |
void * | data | ||
) | [static] |
Push an unused pointer in the trash instead of freeing it.
Instead of freeing a pointer and put pressure on malloc/free you can push it in a trash for a later use. This function just provide a fast way to push a now unused pointer into a trash.
data
, so it's your duty to manage the size.[in] | trash | A pointer to an Eina_Trash. |
data | An unused pointer big enougth to put a (void*). |