\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 \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}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN}}(trash,  data)~while ((data = \mbox{\hyperlink{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}{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}
\subsection*{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}} \mbox{\hyperlink{group__Eina__Trash__Group_ga6ed78366e6324b5259d305673c52188d}{Eina\+\_\+\+Trash}}
\begin{DoxyCompactList}\small\item\em The type for structure \mbox{\hyperlink{struct__Eina__Trash}{\+\_\+\+Eina\+\_\+\+Trash}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{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_ga1ac8805995c1c38f9e2f928c0a482e71}{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}


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



\subsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}\label{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}} 
\index{Trash@{Trash}!E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN@{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN}}
\index{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN@{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN}!Trash@{Trash}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN}{EINA\_TRASH\_CLEAN}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+T\+R\+A\+S\+H\+\_\+\+C\+L\+E\+AN(\begin{DoxyParamCaption}\item[{}]{trash,  }\item[{}]{data }\end{DoxyParamCaption})~while ((data = \mbox{\hyperlink{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}{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}{Parameters}
{\em trash} & The trash to clean \\
\hline
{\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}
\mbox{\hyperlink{struct__Eina__Trash}{Eina\_Trash}} *trash = NULL;
\textcolor{keywordtype}{char} *data;

\textcolor{comment}{// trash is filled with a pointer to some duped strings.}

\mbox{\hyperlink{group__Eina__Trash__Group_ga00b441d87ac8e3417b0026309024c7c0}{EINA\_TRASH\_CLEAN}}(&trash, data)
  free(data);
\end{DoxyCode}


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


\subsection{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}}
\subsubsection{\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{\tt in}  & {\em trash} & The trash\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
You can just set $\ast$trash to {\ttfamily N\+U\+LL} 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}}
\subsubsection{\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{\tt in}  & {\em trash} & A pointer to an Eina\+\_\+\+Trash \\
\hline
 & {\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}


Referenced by eina\+\_\+safepointer\+\_\+unregister().

\mbox{\Hypertarget{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}\label{group__Eina__Trash__Group_ga1ac8805995c1c38f9e2f928c0a482e71}} 
\index{Trash@{Trash}!eina\+\_\+trash\+\_\+pop@{eina\+\_\+trash\+\_\+pop}}
\index{eina\+\_\+trash\+\_\+pop@{eina\+\_\+trash\+\_\+pop}!Trash@{Trash}}
\subsubsection{\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{\tt 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}


Referenced by eina\+\_\+rectangle\+\_\+new().

