\hypertarget{group__Eina__Magic__Group}{}\section{Magic}
\label{group__Eina__Magic__Group}\index{Magic@{Magic}}


\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} provides run-\/time type-\/checking.  


\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE}~0x1234fedc
\begin{DoxyCompactList}\small\item\em Definition of a random value for specifying that a structure using the magic feature has already been freed. \end{DoxyCompactList}\item 
\#define \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC}~\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} \+\_\+\+\_\+magic;
\begin{DoxyCompactList}\small\item\em Definition of of a variable of type \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}. \end{DoxyCompactList}\item 
\#define \hyperlink{group__Eina__Magic__Group_ga470f5ce28eaaf59ce80523be8471c5e0}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET}(d,  m)~(d)-\/$>$\+\_\+\+\_\+magic = (m)
\begin{DoxyCompactList}\small\item\em Definition to set the magic number of {\ttfamily d} to {\ttfamily m}. \end{DoxyCompactList}\item 
\#define \hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK}(d,  m)~(\hyperlink{group__Eina__Types__Group_gaa9820797ec4c069e571f57e3c0c12216}{E\+I\+N\+A\+\_\+\+L\+I\+K\+E\+LY}((d) \&\& ((d)-\/$>$\+\_\+\+\_\+magic == (m))))
\begin{DoxyCompactList}\small\item\em Definition to test if {\ttfamily d} is {\ttfamily N\+U\+LL} or not, and if not {\ttfamily N\+U\+LL}, if {\ttfamily d-\/$>$\+\_\+\+\_\+eina\+\_\+magic} is equal to {\ttfamily m}. \end{DoxyCompactList}\item 
\#define \hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL}(d,  m)
\begin{DoxyCompactList}\small\item\em Definition to call \hyperlink{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}{eina\+\_\+magic\+\_\+fail()} with the parameters {\ttfamily d}, {\ttfamily d-\/$>$\+\_\+\+\_\+magic}, {\ttfamily m}, {\bfseries F\+I\+LE}, {\bfseries F\+U\+N\+C\+T\+I\+ON}, and {\bfseries L\+I\+NE}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}\label{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}} 
typedef unsigned int \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}
\begin{DoxyCompactList}\small\item\em An abstract type for a magic number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
const char $\ast$ \hyperlink{group__Eina__Magic__Group_gaec80eb137d23153cbdbec0d4c400e399}{eina\+\_\+magic\+\_\+string\+\_\+get} (\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} magic)
\begin{DoxyCompactList}\small\item\em Gets the string associated to the given magic identifier. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Magic__Group_ga0d77e61edf5b7b6c276a382d6bf191e7}{eina\+\_\+magic\+\_\+string\+\_\+set} (\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} magic, const char $\ast$magic\+\_\+name)
\begin{DoxyCompactList}\small\item\em Sets the string associated to the given magic identifier. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Magic__Group_ga5d202c69f78f9cb078efd3e798cb5a53}{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set} (\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} magic, const char $\ast$magic\+\_\+name)
\begin{DoxyCompactList}\small\item\em Sets the string associated to the given magic identifier. \end{DoxyCompactList}\item 
void \hyperlink{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}{eina\+\_\+magic\+\_\+fail} (void $\ast$d, \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} m, \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} req\+\_\+m, const char $\ast$file, const char $\ast$fnc, int line)
\begin{DoxyCompactList}\small\item\em Displays a message or aborts if a magic check failed. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Magic__Group_gaab26b6393901fd271b3aa665ef703a3b}\label{group__Eina__Magic__Group_gaab26b6393901fd271b3aa665ef703a3b}} 
\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error} \hyperlink{group__Eina__Magic__Group_gaab26b6393901fd271b3aa665ef703a3b}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+I\+L\+ED}
\begin{DoxyCompactList}\small\item\em The error identifier corresponding to the magic check failure. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Magic__Group_ga995900a133c4fb0a91e3d63afd171f62}\label{group__Eina__Magic__Group_ga995900a133c4fb0a91e3d63afd171f62}} 
\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error} \hyperlink{group__Eina__Magic__Group_ga995900a133c4fb0a91e3d63afd171f62}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+I\+L\+ED} = 0
\begin{DoxyCompactList}\small\item\em The error identifier corresponding to the magic check failure. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} provides run-\/time type-\/checking. 

C is a weak statically typed language, in other words, it just checks for types during compile time and any cast that makes the compiler believe the type is correct.

In the real world code, we often need to deal with casts, either explicit or implicit, by means of {\ttfamily void$\ast$}. We also need to resort to casts when doing inheritance in C.

Eina\+\_\+\+Magic gives us a way to do casts and still be certain of the type we are operating on.

\begin{DoxyNote}{Note}
It should be noted that it is considered a good practice to {\bfseries disable} \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} for production code. The reasoning is that any \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} errors should have been caught during testing and therefore there is no reason to incur the performance downside of \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}.
\end{DoxyNote}
An \hyperlink{eina_magic_example_01_page}{example} should elucidate matters. 

\subsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}\label{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}} 
\index{Magic@{Magic}!E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE}}
\index{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE}!Magic@{Magic}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE}{EINA\_MAGIC\_NONE}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE~0x1234fedc}



Definition of a random value for specifying that a structure using the magic feature has already been freed. 

It is used by \hyperlink{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}{eina\+\_\+magic\+\_\+fail()}.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE} is just {\ttfamily 0}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}.\end{Desc}


Referenced by eina\+\_\+cow\+\_\+free(), eina\+\_\+magic\+\_\+fail(), eina\+\_\+matrixsparse\+\_\+free(), eina\+\_\+simple\+\_\+xml\+\_\+attribute\+\_\+free(), eina\+\_\+tiler\+\_\+equal(), and eldbus\+\_\+message\+\_\+unref().

\mbox{\Hypertarget{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}\label{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}} 
\index{Magic@{Magic}!E\+I\+N\+A\+\_\+\+M\+A\+G\+IC@{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC}}
\index{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC@{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC}!Magic@{Magic}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC}{EINA\_MAGIC}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+M\+A\+G\+IC~\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic} \+\_\+\+\_\+magic;}



Definition of of a variable of type \hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}. 

To put in a structure when one wants to use the magic feature of Eina with the functions of that structure, like this\+:


\begin{DoxyCode}
\textcolor{keyword}{struct }Foo
\{
   \textcolor{keywordtype}{int} i;

   \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\_MAGIC}
\};
\end{DoxyCode}


\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC} does nothing. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}.\end{Desc}
\mbox{\Hypertarget{group__Eina__Magic__Group_ga470f5ce28eaaf59ce80523be8471c5e0}\label{group__Eina__Magic__Group_ga470f5ce28eaaf59ce80523be8471c5e0}} 
\index{Magic@{Magic}!E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET}}
\index{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET}!Magic@{Magic}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET}{EINA\_MAGIC\_SET}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+S\+ET(\begin{DoxyParamCaption}\item[{}]{d,  }\item[{}]{m }\end{DoxyParamCaption})~(d)-\/$>$\+\_\+\+\_\+magic = (m)}



Definition to set the magic number of {\ttfamily d} to {\ttfamily m}. 

{\ttfamily d} must be a valid pointer to a structure holding an Eina magic number declaration. Use \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK} is just the value {\ttfamily 0}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}.\end{Desc}


Referenced by edje\+\_\+color\+\_\+class\+\_\+active\+\_\+iterator\+\_\+new(), edje\+\_\+color\+\_\+class\+\_\+list(), edje\+\_\+file\+\_\+iterator\+\_\+new(), edje\+\_\+mmap\+\_\+color\+\_\+class\+\_\+iterator\+\_\+new(), edje\+\_\+mmap\+\_\+group\+\_\+exists(), edje\+\_\+mmap\+\_\+size\+\_\+class\+\_\+iterator\+\_\+new(), edje\+\_\+mmap\+\_\+text\+\_\+class\+\_\+iterator\+\_\+new(), edje\+\_\+size\+\_\+class\+\_\+active\+\_\+iterator\+\_\+new(), edje\+\_\+size\+\_\+class\+\_\+list(), edje\+\_\+text\+\_\+class\+\_\+active\+\_\+iterator\+\_\+new(), edje\+\_\+text\+\_\+class\+\_\+list(), eet\+\_\+data\+\_\+write(), eet\+\_\+list\+\_\+entries(), eina\+\_\+array\+\_\+new(), eina\+\_\+cow\+\_\+free(), eina\+\_\+cow\+\_\+write(), eina\+\_\+file\+\_\+clean\+\_\+close(), eina\+\_\+hash\+\_\+iterator\+\_\+data\+\_\+new(), eina\+\_\+hash\+\_\+iterator\+\_\+key\+\_\+new(), eina\+\_\+hash\+\_\+iterator\+\_\+tuple\+\_\+new(), eina\+\_\+inarray\+\_\+accessor\+\_\+new(), eina\+\_\+inarray\+\_\+iterator\+\_\+new(), eina\+\_\+inarray\+\_\+iterator\+\_\+reversed\+\_\+new(), eina\+\_\+inlist\+\_\+accessor\+\_\+new(), eina\+\_\+inlist\+\_\+iterator\+\_\+new(), eina\+\_\+list\+\_\+iterator\+\_\+new(), eina\+\_\+list\+\_\+iterator\+\_\+reversed\+\_\+new(), eina\+\_\+matrixsparse\+\_\+free(), eina\+\_\+matrixsparse\+\_\+iterator\+\_\+complete\+\_\+new(), eina\+\_\+matrixsparse\+\_\+iterator\+\_\+new(), eina\+\_\+rectangle\+\_\+pool\+\_\+new(), eina\+\_\+simple\+\_\+xml\+\_\+attribute\+\_\+free(), eina\+\_\+simple\+\_\+xml\+\_\+attribute\+\_\+new(), eina\+\_\+simple\+\_\+xml\+\_\+node\+\_\+load(), eina\+\_\+simple\+\_\+xml\+\_\+node\+\_\+tag\+\_\+new(), eina\+\_\+tile\+\_\+grid\+\_\+slicer\+\_\+iterator\+\_\+new(), eina\+\_\+tiler\+\_\+equal(), eina\+\_\+xattr\+\_\+fd\+\_\+ls(), eina\+\_\+xattr\+\_\+value\+\_\+fd\+\_\+ls(), eldbus\+\_\+message\+\_\+unref(), and evas\+\_\+smart\+\_\+legacy\+\_\+type\+\_\+register().

\mbox{\Hypertarget{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}\label{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}} 
\index{Magic@{Magic}!E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK}}
\index{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK}!Magic@{Magic}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK}{EINA\_MAGIC\_CHECK}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK(\begin{DoxyParamCaption}\item[{}]{d,  }\item[{}]{m }\end{DoxyParamCaption})~(\hyperlink{group__Eina__Types__Group_gaa9820797ec4c069e571f57e3c0c12216}{E\+I\+N\+A\+\_\+\+L\+I\+K\+E\+LY}((d) \&\& ((d)-\/$>$\+\_\+\+\_\+magic == (m))))}



Definition to test if {\ttfamily d} is {\ttfamily N\+U\+LL} or not, and if not {\ttfamily N\+U\+LL}, if {\ttfamily d-\/$>$\+\_\+\+\_\+eina\+\_\+magic} is equal to {\ttfamily m}. 

{\ttfamily d} must be a structure that holds an Eina magic number declaration. Use \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+C\+H\+E\+CK} is just the value {\ttfamily 1}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}.\end{Desc}


Referenced by eet\+\_\+data\+\_\+write().

\mbox{\Hypertarget{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}\label{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}} 
\index{Magic@{Magic}!E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL}}
\index{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL@{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL}!Magic@{Magic}}
\subsubsection{\texorpdfstring{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL}{EINA\_MAGIC\_FAIL}}
{\footnotesize\ttfamily \#define E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL(\begin{DoxyParamCaption}\item[{}]{d,  }\item[{}]{m }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}
\hyperlink{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}{eina\_magic\_fail}((\textcolor{keywordtype}{void} *)(d),            \(\backslash\)
                  (d) ? (d)->\_\_magic : 0, \(\backslash\)
                  (m),                    \(\backslash\)
                  \_\_FILE\_\_,               \(\backslash\)
                  \_\_FUNCTION\_\_,           \(\backslash\)
                  \_\_LINE\_\_);
\end{DoxyCode}


Definition to call \hyperlink{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}{eina\+\_\+magic\+\_\+fail()} with the parameters {\ttfamily d}, {\ttfamily d-\/$>$\+\_\+\+\_\+magic}, {\ttfamily m}, {\bfseries F\+I\+LE}, {\bfseries F\+U\+N\+C\+T\+I\+ON}, and {\bfseries L\+I\+NE}. 

{\ttfamily d} must be a structure that holds an Eina magic number declaration. Use \hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{E\+I\+N\+A\+\_\+\+M\+A\+G\+IC} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+IL} does nothing. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}.\end{Desc}


\subsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Magic__Group_gaec80eb137d23153cbdbec0d4c400e399}\label{group__Eina__Magic__Group_gaec80eb137d23153cbdbec0d4c400e399}} 
\index{Magic@{Magic}!eina\+\_\+magic\+\_\+string\+\_\+get@{eina\+\_\+magic\+\_\+string\+\_\+get}}
\index{eina\+\_\+magic\+\_\+string\+\_\+get@{eina\+\_\+magic\+\_\+string\+\_\+get}!Magic@{Magic}}
\subsubsection{\texorpdfstring{eina\+\_\+magic\+\_\+string\+\_\+get()}{eina\_magic\_string\_get()}}
{\footnotesize\ttfamily const char$\ast$ eina\+\_\+magic\+\_\+string\+\_\+get (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}]{magic }\end{DoxyParamCaption})}



Gets the string associated to the given magic identifier. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em magic} & The magic identifier \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The string associated to the identifier
\end{DoxyReturn}
This function returns the string associated to {\ttfamily magic}. Even if none are found this function still returns non {\ttfamily N\+U\+LL}, in this case an identifier such as \char`\"{}(none)\char`\"{}, \char`\"{}(undefined)\char`\"{}, or \char`\"{}(unknown)\char`\"{}.

\begin{DoxyNote}{Note}
The following identifiers may be returned whenever magic is invalid, with their meanings\+:
\end{DoxyNote}

\begin{DoxyItemize}
\item (none)\+: No magic that had been registered exists at all.
\item (undefined)\+: Magic is registered and found, but no string is associated.
\item (unknown)\+: Magic is not found in the registry.
\end{DoxyItemize}

\begin{DoxyWarning}{Warning}
The returned value must not be freed. 
\end{DoxyWarning}


Referenced by eina\+\_\+magic\+\_\+fail().

\mbox{\Hypertarget{group__Eina__Magic__Group_ga0d77e61edf5b7b6c276a382d6bf191e7}\label{group__Eina__Magic__Group_ga0d77e61edf5b7b6c276a382d6bf191e7}} 
\index{Magic@{Magic}!eina\+\_\+magic\+\_\+string\+\_\+set@{eina\+\_\+magic\+\_\+string\+\_\+set}}
\index{eina\+\_\+magic\+\_\+string\+\_\+set@{eina\+\_\+magic\+\_\+string\+\_\+set}!Magic@{Magic}}
\subsubsection{\texorpdfstring{eina\+\_\+magic\+\_\+string\+\_\+set()}{eina\_magic\_string\_set()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+magic\+\_\+string\+\_\+set (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}]{magic,  }\item[{const char $\ast$}]{magic\+\_\+name }\end{DoxyParamCaption})}



Sets the string associated to the given magic identifier. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em magic} & The magic identifier \\
\hline
\mbox{\tt in}  & {\em magic\+\_\+name} & The string associated to the identifier, must not be {\ttfamily N\+U\+LL} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE} on success, otherwise \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE} on failure
\end{DoxyReturn}
This function sets the string {\ttfamily magic\+\_\+name} to {\ttfamily magic}. It is not checked if number or string are already set, in which case you end with duplicates. Internally, eina makes a copy of {\ttfamily magic\+\_\+name}.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Eina__Magic__Group_ga5d202c69f78f9cb078efd3e798cb5a53}{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set()} 
\end{DoxySeeAlso}


Referenced by ecore\+\_\+con\+\_\+init(), and eldbus\+\_\+init().

\mbox{\Hypertarget{group__Eina__Magic__Group_ga5d202c69f78f9cb078efd3e798cb5a53}\label{group__Eina__Magic__Group_ga5d202c69f78f9cb078efd3e798cb5a53}} 
\index{Magic@{Magic}!eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set@{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set}}
\index{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set@{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set}!Magic@{Magic}}
\subsubsection{\texorpdfstring{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set()}{eina\_magic\_string\_static\_set()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}]{magic,  }\item[{const char $\ast$}]{magic\+\_\+name }\end{DoxyParamCaption})}



Sets the string associated to the given magic identifier. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em magic} & The magic identifier \\
\hline
\mbox{\tt in}  & {\em magic\+\_\+name} & The string associated to the identifier, must not be {\ttfamily N\+U\+LL} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE} on success, otherwise \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE} on failure
\end{DoxyReturn}
This function sets the string {\ttfamily magic\+\_\+name} to {\ttfamily magic}. It is not checked if number or string are already set, in which case you might end with duplicates. Eina does {\bfseries not} make a copy of {\ttfamily magic\+\_\+name}, this means that {\ttfamily magic\+\_\+name} has to be a valid pointer for as long as {\ttfamily magic} is used.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Eina__Magic__Group_ga0d77e61edf5b7b6c276a382d6bf191e7}{eina\+\_\+magic\+\_\+string\+\_\+set()} 
\end{DoxySeeAlso}


Referenced by eo\+\_\+init().

\mbox{\Hypertarget{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}\label{group__Eina__Magic__Group_ga1b837f53d9fbb370b29b0818d6c94a10}} 
\index{Magic@{Magic}!eina\+\_\+magic\+\_\+fail@{eina\+\_\+magic\+\_\+fail}}
\index{eina\+\_\+magic\+\_\+fail@{eina\+\_\+magic\+\_\+fail}!Magic@{Magic}}
\subsubsection{\texorpdfstring{eina\+\_\+magic\+\_\+fail()}{eina\_magic\_fail()}}
{\footnotesize\ttfamily void eina\+\_\+magic\+\_\+fail (\begin{DoxyParamCaption}\item[{void $\ast$}]{d,  }\item[{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}]{m,  }\item[{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}]{req\+\_\+m,  }\item[{const char $\ast$}]{file,  }\item[{const char $\ast$}]{fnc,  }\item[{int}]{line }\end{DoxyParamCaption})}



Displays a message or aborts if a magic check failed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em d} & The checked data pointer \\
\hline
\mbox{\tt in}  & {\em m} & The magic identifier to check \\
\hline
\mbox{\tt in}  & {\em req\+\_\+m} & The requested magic identifier to check \\
\hline
\mbox{\tt in}  & {\em file} & The file in which the magic check failed \\
\hline
\mbox{\tt in}  & {\em fnc} & The function in which the magic check failed \\
\hline
\mbox{\tt in}  & {\em line} & The line at which the magic check failed\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
You should {\bfseries strongly} consider using \hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+F\+A\+I\+L(d, m)} instead.
\end{DoxyWarning}
This function displays an error message if a magic check has failed, using the following logic in the following order\+: \begin{DoxyItemize}
\item If {\ttfamily d} is {\ttfamily N\+U\+LL}, a message warns about a {\ttfamily N\+U\+LL} pointer. \item Otherwise, if {\ttfamily m} is equal to \hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE}, a message warns about a handle that is already freed. \item Otherwise, if {\ttfamily m} is equal to {\ttfamily req\+\_\+m}, a message warns about a handle that is of the wrong type. \item Otherwise, a message warns you about abusing that function...\end{DoxyItemize}
\begin{DoxyNote}{Note}
If the environment variable E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+A\+B\+O\+RT is set, abort() is called and the program stops. It is useful for debugging programs with gdb. 
\end{DoxyNote}


References E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+D\+O\+M\+A\+I\+N\+\_\+\+G\+L\+O\+B\+AL, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+L\+E\+V\+E\+L\+\_\+\+C\+R\+I\+T\+I\+C\+AL, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+L\+E\+V\+E\+L\+\_\+\+E\+RR, eina\+\_\+log\+\_\+print(), E\+I\+N\+A\+\_\+\+M\+A\+G\+I\+C\+\_\+\+N\+O\+NE, and eina\+\_\+magic\+\_\+string\+\_\+get().

