\hypertarget{eina_inlist_02_8c-example}{}\doxysection{eina\+\_\+inlist\+\_\+02.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Compile with:}}
\DoxyCodeLine{\textcolor{comment}{// gcc -\/g eina\_inlist\_02.c -\/o eina\_inlist\_02 `pkg-\/config -\/-\/cflags -\/-\/libs eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{struct }my\_struct \{}
\DoxyCodeLine{     \mbox{\hyperlink{group__Eina__Inline__List__Group_gab30a76fcfa50307c797491705d60136a}{EINA\_INLIST}};}
\DoxyCodeLine{     \textcolor{keywordtype}{int} a, b;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{struct }my\_struct *d, *cur;}
\DoxyCodeLine{   \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Inlist}{Eina\_Inlist}} *inlist = NULL;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *list = NULL, *l\_itr, *l\_next;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < 100; i++)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        d = malloc(\textcolor{keyword}{sizeof}(*d));}
\DoxyCodeLine{        d-\/>a = i;}
\DoxyCodeLine{        d-\/>b = i * 10;}
\DoxyCodeLine{        inlist = \mbox{\hyperlink{group__Eina__Inline__List__Group_ga095c6abf8b0122e30271ce98c26c0524}{eina\_inlist\_append}}(inlist, \mbox{\hyperlink{group__Eina__Inline__List__Group_ga5bc991428e75557c6195f6b9e38321fb}{EINA\_INLIST\_GET}}(d));}
\DoxyCodeLine{        \textcolor{keywordflow}{if} ((i \% 2) == 0)}
\DoxyCodeLine{          list = \mbox{\hyperlink{group__Eina__List__Group_ga9f35bfc7c5b798014c3e0a74bc6f39ad}{eina\_list\_prepend}}(list, d);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}inlist=\%p\(\backslash\)n"{}}, inlist);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__List__Group_ga65e496b9b16d527d23c1d735652b4e62}{EINA\_INLIST\_FOREACH}}(inlist, cur)}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"{}\(\backslash\)ta=\%d, b=\%d\(\backslash\)n"{}}, cur-\/>a, cur-\/>b);}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}list=\%p\(\backslash\)n"{}}, list);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(list, l\_itr, cur)}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"{}\(\backslash\)ta=\%d, b=\%d\(\backslash\)n"{}}, cur-\/>a, cur-\/>b);}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}inlist count=\%d\(\backslash\)n"{}}, \mbox{\hyperlink{group__Eina__Inline__List__Group_ga20d6e4482cda609591cb504c7f0463f5}{eina\_inlist\_count}}(inlist));}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}list count=\%d\(\backslash\)n\(\backslash\)n"{}}, \mbox{\hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}}(list));}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_ga5b4d2aac696cd2558aaed03e3929d873}{EINA\_LIST\_FOREACH\_SAFE}}(list, l\_itr, l\_next, cur)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} ((cur-\/>a \% 3) == 0)}
\DoxyCodeLine{          list = \mbox{\hyperlink{group__Eina__List__Group_ga7edefe0975beecc76c02525fb9200f5a}{eina\_list\_remove\_list}}(list, l\_itr);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}inlist count=\%d\(\backslash\)n"{}}, \mbox{\hyperlink{group__Eina__Inline__List__Group_ga20d6e4482cda609591cb504c7f0463f5}{eina\_inlist\_count}}(inlist));}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}list count=\%d\(\backslash\)n\(\backslash\)n"{}}, \mbox{\hyperlink{group__Eina__List__Group_ga301729054a498a2df09a5f1dd760697e}{eina\_list\_count}}(list));}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_ga608bd2fbf06293a1b794648990703ab4}{eina\_list\_free}}(list);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{while} (inlist)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keyword}{struct }my\_struct *aux = \mbox{\hyperlink{group__Eina__Inline__List__Group_ga8c4e6011e7caa9ec5c22b003c4950338}{EINA\_INLIST\_CONTAINER\_GET}}(inlist,}
\DoxyCodeLine{                                                          \textcolor{keyword}{struct} my\_struct);}
\DoxyCodeLine{        inlist = \mbox{\hyperlink{group__Eina__Inline__List__Group_gad84d4a8ad4c3392df4be8278ce10a274}{eina\_inlist\_remove}}(inlist, inlist);}
\DoxyCodeLine{        free(aux);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 