Tizen Native API
|
Functions | |
static void | eina_trash_init (Eina_Trash **trash) |
Initializes a trash before using it. | |
static void | eina_trash_push (Eina_Trash **trash, void *data) |
Pushes an unused pointer in the trash instead of freeing it. | |
static void * | eina_trash_pop (Eina_Trash **trash) |
Pops an available pointer from the trash if possible. | |
Typedefs | |
typedef struct _Eina_Trash | Eina_Trash |
The type for strcuture _Eina_Trash. | |
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 Documentation
#define EINA_TRASH_CLEAN | ( | trash, | |
data | |||
) | while ((data = eina_trash_pop(trash))) |
Definition of a macro to remove all the pointers from the trash.
- Parameters:
-
trash The trash to clean data The pointer extracted 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.
- Since :
- 2.3
- Note:
- This macro can be used for freeing the data in the trash, like in the following example:
Eina_Trash *trash = NULL; char *data; // trash is filled with a pointer to some duped strings. EINA_TRASH_CLEAN(&trash, data) free(data);
- Note:
- This macro is useful when you implement some memory pool.
Function Documentation
static void eina_trash_init | ( | Eina_Trash ** | trash | ) | [static] |
Initializes a trash before using it.
- Since :
- 2.3
- Parameters:
-
[in] trash The trash
This function just set to zero the trash to correctly initialize it.
- Remarks:
- You can just set *trash to
NULL
and you will have the same result.
static void* eina_trash_pop | ( | Eina_Trash ** | trash | ) | [static] |
Pops an available pointer from the trash if possible.
- Since :
- 2.3
- Parameters:
-
[in] trash A Eina_Trash handle
Instead of calling malloc, and putting pressure on malloc/free you can recycle the content of the trash, if it's not empty.
- Remarks:
- This trash will not resize, nor do anything with the size of the region pointed by pointer inside the trash, so it's your duty to manage the size of the returned pointer.
static void eina_trash_push | ( | Eina_Trash ** | trash, |
void * | data | ||
) | [static] |
Pushes an unused pointer in the trash instead of freeing it.
- Since :
- 2.3
- Parameters:
-
[in] trash A pointer to an Eina_Trash data An unused pointer big enougth to put a (void*)
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.
- Remarks:
- Do not use the pointer after insertion or bad things will happens.
-
This trash will not resize, nor do anything with the size of the region pointed by
data
, so it's your duty to manage the size.