\hypertarget{group__Eina__Trash__Group}{}\doxysection{Trash}
\label{group__Eina__Trash__Group}\index{Trash@{Trash}}


This group provides a generic container.  


\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash}}
\begin{DoxyCompactList}\small\item\em The structure type for a generic container of an unused allocated pointer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{EINA\+\_\+\+TRASH\+\_\+\+CLEAN}}(trash,  data)~while ((data = eina\+\_\+trash\+\_\+pop(trash)))
\begin{DoxyCompactList}\small\item\em Definition for a macro to remove all the pointers from the trash. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}\label{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}} 
typedef struct \mbox{\hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash}} {\bfseries Eina\+\_\+\+Trash}
\begin{DoxyCompactList}\small\item\em The type for structure \mbox{\hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \mbox{\hyperlink{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}{eina\+\_\+trash\+\_\+init}} (\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$trash)
\begin{DoxyCompactList}\small\item\em Initializes a trash before using it. \end{DoxyCompactList}\item 
static void \mbox{\hyperlink{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}{eina\+\_\+trash\+\_\+push}} (\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$trash, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Pushes an unused pointer in the trash instead of freeing it. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{group__Eina__Trash__Group_gae10432e5c9492b9fe6efeb37e9be96c6}{eina\+\_\+trash\+\_\+pop}} (\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$trash)
\begin{DoxyCompactList}\small\item\em Pops an available pointer from the trash if possible. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This group provides a generic container. 



\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}\label{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}} 
\index{Trash@{Trash}!EINA\_TRASH\_CLEAN@{EINA\_TRASH\_CLEAN}}
\index{EINA\_TRASH\_CLEAN@{EINA\_TRASH\_CLEAN}!Trash@{Trash}}
\doxysubsubsection{\texorpdfstring{EINA\_TRASH\_CLEAN}{EINA\_TRASH\_CLEAN}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+TRASH\+\_\+\+CLEAN(\begin{DoxyParamCaption}\item[{}]{trash,  }\item[{}]{data }\end{DoxyParamCaption})~while ((data = eina\+\_\+trash\+\_\+pop(trash)))}



Definition for a macro to remove all the pointers from the trash. 

This macro allows the cleaning of {\itshape trash} in an easy way. It removes all the pointers from {\itshape trash} until it\textquotesingle{}s empty.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em trash} & The trash to clean \\
\hline
\mbox{\texttt{ out}}  & {\em data} & The pointer extracted from the trash\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
This macro can be used for freeing the data in the trash, like in the following example\+:
\end{DoxyNote}

\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{struct__Eina__Trash}{Eina\_Trash}}\ *trash\ =\ NULL;}
\DoxyCodeLine{\textcolor{keywordtype}{char}\ *data;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ trash\ is\ filled\ with\ a\ pointer\ to\ some\ duped\ strings.}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{EINA\_TRASH\_CLEAN}}(\&trash,\ data)}
\DoxyCodeLine{\ \ free(data);}

\end{DoxyCode}


\begin{DoxyNote}{Note}
This macro is useful when you implement some memory pool. 
\end{DoxyNote}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}\label{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}} 
\index{Trash@{Trash}!eina\_trash\_init@{eina\_trash\_init}}
\index{eina\_trash\_init@{eina\_trash\_init}!Trash@{Trash}}
\doxysubsubsection{\texorpdfstring{eina\_trash\_init()}{eina\_trash\_init()}}
{\footnotesize\ttfamily static void eina\+\_\+trash\+\_\+init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$}]{trash }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Initializes a trash before using it. 

This function just set to zero the trash to correctly initialize it.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em trash} & The trash\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
You can just set $\ast$trash to {\ttfamily NULL} and you will have the same result. 
\end{DoxyNote}
\mbox{\Hypertarget{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}\label{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}} 
\index{Trash@{Trash}!eina\_trash\_push@{eina\_trash\_push}}
\index{eina\_trash\_push@{eina\_trash\_push}!Trash@{Trash}}
\doxysubsubsection{\texorpdfstring{eina\_trash\_push()}{eina\_trash\_push()}}
{\footnotesize\ttfamily static void eina\+\_\+trash\+\_\+push (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$}]{trash,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Pushes 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.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em trash} & A pointer to an Eina\+\_\+\+Trash \\
\hline
\mbox{\texttt{ in}}  & {\em data} & An unused pointer big enough to put a (void$\ast$)\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
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 {\ttfamily data}, so it\textquotesingle{}s your duty to manage the size. 
\end{DoxyNote}
\mbox{\Hypertarget{group__Eina__Trash__Group_gae10432e5c9492b9fe6efeb37e9be96c6}\label{group__Eina__Trash__Group_gae10432e5c9492b9fe6efeb37e9be96c6}} 
\index{Trash@{Trash}!eina\_trash\_pop@{eina\_trash\_pop}}
\index{eina\_trash\_pop@{eina\_trash\_pop}!Trash@{Trash}}
\doxysubsubsection{\texorpdfstring{eina\_trash\_pop()}{eina\_trash\_pop()}}
{\footnotesize\ttfamily static void $\ast$ eina\+\_\+trash\+\_\+pop (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} $\ast$$\ast$}]{trash }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Pops 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\textquotesingle{}s not empty.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em trash} & A \mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}} handle\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
This trash will not resize, nor do anything with the size of the region pointed by pointer inside the trash, so it\textquotesingle{}s your duty to manage the size of the returned pointer. 
\end{DoxyNote}
