

Just the usual includes\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <string.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}

\end{DoxyCodeInclude}


This is the callback we are going to use to decide which strings stay on the array and which will be removed. We use something simple, but this can be as complex as you like\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} keep(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{void} *gdata \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strlen((\textcolor{keyword}{const} \textcolor{keywordtype}{char}*)data) <= 5)}
\DoxyCodeLine{      \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


This is the same code we used before to populate the list with the slight difference of not using strdup\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char}* strs[] = \{}
\DoxyCodeLine{      \textcolor{stringliteral}{"one"}, \textcolor{stringliteral}{"two"}, \textcolor{stringliteral}{"three"}, \textcolor{stringliteral}{"four"}, \textcolor{stringliteral}{"five"}, \textcolor{stringliteral}{"six"}, \textcolor{stringliteral}{"seven"}, \textcolor{stringliteral}{"eight"}, \textcolor{stringliteral}{"nine"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"ten"}, \textcolor{stringliteral}{"eleven"}, \textcolor{stringliteral}{"twelve"}, \textcolor{stringliteral}{"thirteen"}, \textcolor{stringliteral}{"fourtenn"}, \textcolor{stringliteral}{"fifteen"}, \textcolor{stringliteral}{"sixteen"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"seventeen"}, \textcolor{stringliteral}{"eighteen"}, \textcolor{stringliteral}{"nineteen"}, \textcolor{stringliteral}{"twenty"}}
\DoxyCodeLine{   \};}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char}* strings[] = \{}
\DoxyCodeLine{      \textcolor{stringliteral}{"helo"}, \textcolor{stringliteral}{"hera"}, \textcolor{stringliteral}{"starbuck"}, \textcolor{stringliteral}{"kat"}, \textcolor{stringliteral}{"boomer"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"hotdog"}, \textcolor{stringliteral}{"longshot"}, \textcolor{stringliteral}{"jammer"}, \textcolor{stringliteral}{"crashdown"}, \textcolor{stringliteral}{"hardball"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"duck"}, \textcolor{stringliteral}{"racetrack"}, \textcolor{stringliteral}{"apolo"}, \textcolor{stringliteral}{"husker"}, \textcolor{stringliteral}{"freaker"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"skulls"}, \textcolor{stringliteral}{"bulldog"}, \textcolor{stringliteral}{"flat top"}, \textcolor{stringliteral}{"hammerhead"}, \textcolor{stringliteral}{"gonzo"}}
\DoxyCodeLine{   \};}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Array}{Eina\_Array}} *array;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_gaf9af7cd8afa60d6b1cab805bd5b838aa}{Eina\_Array\_Iterator}} iterator;}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *item;}
\DoxyCodeLine{   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   array = \mbox{\hyperlink{group__Eina__Array__Group_ga4a389204db37b44b31d29f581258ac7d}{eina\_array\_new}}(10);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < 20; i++)}
\DoxyCodeLine{     \mbox{\hyperlink{group__Eina__Array__Group_gaf2f4a5907f1826354977adbd63e3379a}{eina\_array\_push}}(array, strs[i]);}

\end{DoxyCodeInclude}


So we have added all our elements to the array, but it turns out that is not the elements we wanted, so let\textquotesingle{}s empty the array and add the correct strings\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_ga09564606d36b330d63ec1dde1e96a749}{eina\_array\_clean}}(array);}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < 20; i++)}
\DoxyCodeLine{     \mbox{\hyperlink{group__Eina__Array__Group_gaf2f4a5907f1826354977adbd63e3379a}{eina\_array\_push}}(array, strings[i]);}

\end{DoxyCodeInclude}


It seems we made a little mistake in one of our strings so we need to replace it, here is how\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_ga466c2d377561b4dde4a4c67988ba32f6}{eina\_array\_data\_set}}(array, 17, \textcolor{stringliteral}{"flattop"});}

\end{DoxyCodeInclude}


Now that there is a populated array we can remove elements from it easily\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_gab4171f1665fadbf71ff3f418258e8a31}{eina\_array\_remove}}(array, keep, NULL);}

\end{DoxyCodeInclude}


And check that the elements were actually removed\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_ga810ed3618ca03f7d549a1bf2c33b2b6e}{EINA\_ARRAY\_ITER\_NEXT}}(array, i, item, iterator)}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"item \#\%u: \%s\(\backslash\)n"}, i, item);}

\end{DoxyCodeInclude}


Since this time we didn\textquotesingle{}t use strdup we don\textquotesingle{}t need to free each string\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Array__Group_gacd0118606f9e5b42839b91ed0da8b168}{eina\_array\_free}}(array);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


The full source code can be found in the examples folder in the \mbox{\hyperlink{eina_array_02_c}{eina\+\_\+array\+\_\+02.c}} file. 