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


This group provides a generic container.  


\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \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}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N}(trash, data)~while ((data = \hyperlink{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}{eina\+\_\+trash\+\_\+pop}(trash)))
\begin{DoxyCompactList}\small\item\em Definition of a macro to remove all the pointers from the trash. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{typedef struct \hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash} \hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}}\label{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}

\begin{DoxyCompactList}\small\item\em The type for strcuture \hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}{eina\+\_\+trash\+\_\+init} (\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 \hyperlink{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}{eina\+\_\+trash\+\_\+push} (\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$ \hyperlink{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}{eina\+\_\+trash\+\_\+pop} (\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}


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



\subsection{Macro Definition Documentation}
\hypertarget{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{\index{Trash@{Trash}!E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N@{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N}}
\index{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N@{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N}!Trash@{Trash}}
\subsubsection[{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N}]{\setlength{\rightskip}{0pt plus 5cm}\#define E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+A\+N(
\begin{DoxyParamCaption}
\item[{}]{trash, }
\item[{}]{data}
\end{DoxyParamCaption}
)~while ((data = {\bf eina\+\_\+trash\+\_\+pop}(trash)))}}\label{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}


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


\begin{DoxyParams}{Parameters}
{\em trash} & The trash to clean \\
\hline
{\em data} & The pointer extracted from the trash\\
\hline
\end{DoxyParams}
This macro allows the cleaning of {\itshape trash} in an easy way. It removes all the pointers from {\itshape trash} until it's empty.

\begin{DoxyNote}{Note}
This macro can be used for freeing the data in the trash, like in the following example\+:
\end{DoxyNote}

\begin{DoxyCode}
1 Eina\_Trash *trash = NULL;
2 char *data;
3 
4 // trash is filled with a pointer to some duped strings.
5 
6 EINA\_TRASH\_CLEAN(&trash, data)
7   free(data);
\end{DoxyCode}


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


Referenced by eio\+\_\+shutdown().



\subsection{Function Documentation}
\hypertarget{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}{\index{Trash@{Trash}!eina\+\_\+trash\+\_\+init@{eina\+\_\+trash\+\_\+init}}
\index{eina\+\_\+trash\+\_\+init@{eina\+\_\+trash\+\_\+init}!Trash@{Trash}}
\subsubsection[{eina\+\_\+trash\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}static void eina\+\_\+trash\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Trash} $\ast$$\ast$}]{trash}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Trash__Group_ga60db271d45f986ade3a05ac84493be78}


Initializes a trash before using it. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em trash} & The trash\\
\hline
\end{DoxyParams}
This function just set to zero the trash to correctly initialize it.

\begin{DoxyNote}{Note}
You can just set $\ast$trash to {\ttfamily N\+U\+L\+L} and you will have the same result. 
\end{DoxyNote}
\hypertarget{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}{\index{Trash@{Trash}!eina\+\_\+trash\+\_\+push@{eina\+\_\+trash\+\_\+push}}
\index{eina\+\_\+trash\+\_\+push@{eina\+\_\+trash\+\_\+push}!Trash@{Trash}}
\subsubsection[{eina\+\_\+trash\+\_\+push}]{\setlength{\rightskip}{0pt plus 5cm}static void eina\+\_\+trash\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Trash} $\ast$$\ast$}]{trash, }
\item[{void $\ast$}]{data}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Trash__Group_ga4187333fa1b6d28e1aad2e58bc059906}


Pushes an unused pointer in the trash instead of freeing it. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em trash} & A pointer to an Eina\+\_\+\+Trash \\
\hline
 & {\em data} & An unused pointer big enougth to put a (void$\ast$)\\
\hline
\end{DoxyParams}
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{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's your duty to manage the size. 
\end{DoxyNote}


Referenced by eina\+\_\+rectangle\+\_\+free(), and eina\+\_\+rectangle\+\_\+pool\+\_\+release().

\hypertarget{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}{\index{Trash@{Trash}!eina\+\_\+trash\+\_\+pop@{eina\+\_\+trash\+\_\+pop}}
\index{eina\+\_\+trash\+\_\+pop@{eina\+\_\+trash\+\_\+pop}!Trash@{Trash}}
\subsubsection[{eina\+\_\+trash\+\_\+pop}]{\setlength{\rightskip}{0pt plus 5cm}static void$\ast$ eina\+\_\+trash\+\_\+pop (
\begin{DoxyParamCaption}
\item[{{\bf Eina\+\_\+\+Trash} $\ast$$\ast$}]{trash}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}


Pops an available pointer from the trash if possible. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em trash} & A \hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash} handle\\
\hline
\end{DoxyParams}
Instead of calling malloc, and putting pressure on malloc/free you can recycle the content of the trash, if it's not empty.

\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's your duty to manage the size of the returned pointer. 
\end{DoxyNote}


Referenced by eina\+\_\+rectangle\+\_\+new(), eina\+\_\+rectangle\+\_\+pool\+\_\+free(), and eina\+\_\+rectangle\+\_\+pool\+\_\+request().

