Trash
[Containers]

Data Structures

struct  _Eina_Trash
 Type for a generic container of unused allocated pointer. More...

Defines

#define EINA_TRASH_CLEAN(trash, data)   while ((data = eina_trash_pop(trash)))
 Macro to remove all pointer from the trash.

Typedefs

typedef struct _Eina_Trash Eina_Trash
 Type for a generic container of unused allocated pointer.

Functions

static void eina_trash_init (Eina_Trash **trash)
static void eina_trash_push (Eina_Trash **trash, void *data)
static void * eina_trash_pop (Eina_Trash **trash)

Define Documentation

#define EINA_TRASH_CLEAN ( trash,
data   )     while ((data = eina_trash_pop(trash)))

Macro to remove all pointer from the trash.

Parameters:
trash The trash to clean.
data The pointer extracted from the trash.

This macro allow the cleaning of trash in an easy way. It will remove all pointers from trash until it's empty.

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 pointer to some duped strings.

 EINA_TRASH_CLEAN(&trash, data)
   free(data);
Note:
this macro is useful when you implement some memory pool.