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


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


\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{EINA\+\_\+\+MAGIC\+\_\+\+NONE}}~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 \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\+\_\+\+MAGIC}}~\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} \+\_\+\+\_\+magic;
\begin{DoxyCompactList}\small\item\em Definition of of a variable of type \mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{group__Eina__Magic__Group_ga470f5ce28eaaf59ce80523be8471c5e0}{EINA\+\_\+\+MAGIC\+\_\+\+SET}}(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 \mbox{\hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{EINA\+\_\+\+MAGIC\+\_\+\+CHECK}}(d,  m)~(\mbox{\hyperlink{group__Eina__Types__Group_gaa9820797ec4c069e571f57e3c0c12216}{EINA\+\_\+\+LIKELY}}((d) \&\& ((d)-\/$>$\+\_\+\+\_\+magic == (m))))
\begin{DoxyCompactList}\small\item\em Definition to test if {\ttfamily d} is {\ttfamily NULL} or not, and if not {\ttfamily NULL}, if {\ttfamily d-\/\texorpdfstring{$>$}{>}\+\_\+\+\_\+eina\+\_\+magic} is equal to {\ttfamily m}. \end{DoxyCompactList}\item 
\#define \mbox{\hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{EINA\+\_\+\+MAGIC\+\_\+\+FAIL}}(d,  m)
\begin{DoxyCompactList}\small\item\em Definition to call \mbox{\hyperlink{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}{eina\+\_\+magic\+\_\+fail()}} with the parameters {\ttfamily d}, {\ttfamily d-\/\texorpdfstring{$>$}{>}\+\_\+\+\_\+magic}, {\ttfamily m}, {\bfseries{FILE}}, {\bfseries{func}}, and {\bfseries{LINE}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}\label{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}} 
typedef unsigned int {\bfseries Eina\+\_\+\+Magic}
\begin{DoxyCompactList}\small\item\em An abstract type for a magic number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} const char $\ast$ \mbox{\hyperlink{group__Eina__Magic__Group_gae60262e80f5ebf7961ffe904b45e3877}{eina\+\_\+magic\+\_\+string\+\_\+get}} (\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} magic)
\begin{DoxyCompactList}\small\item\em Gets the string associated with the given magic identifier. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Magic__Group_ga977e1491bee34a57366e263e7dbab6df}{eina\+\_\+magic\+\_\+string\+\_\+set}} (\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} magic, const char $\ast$magic\+\_\+name)
\begin{DoxyCompactList}\small\item\em Sets the string associated with the given magic identifier. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Magic__Group_ga045b40787a82c640980bf331cecc4205}{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set}} (\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} magic, const char $\ast$magic\+\_\+name)
\begin{DoxyCompactList}\small\item\em Sets the string associated with the given magic identifier. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void \mbox{\hyperlink{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}{eina\+\_\+magic\+\_\+fail}} (void $\ast$d, \mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} m, \mbox{\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}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Magic__Group_ga2ad9fbf6c61d89c27247aa8fa7bc1617}\label{group__Eina__Magic__Group_ga2ad9fbf6c61d89c27247aa8fa7bc1617}} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+MAGIC\+\_\+\+FAILED}
\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}} 
\mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} {\bfseries EINA\+\_\+\+ERROR\+\_\+\+MAGIC\+\_\+\+FAILED} = 0
\begin{DoxyCompactList}\small\item\em The error identifier corresponding to the magic check failure. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\mbox{\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}} \mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} for production code. The reasoning is that any \mbox{\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 \mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}.
\end{DoxyNote}
An \mbox{\hyperlink{eina_magic_example_01_page}{example}} should elucidate matters. 

\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}\label{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}} 
\index{Magic@{Magic}!EINA\_MAGIC\_NONE@{EINA\_MAGIC\_NONE}}
\index{EINA\_MAGIC\_NONE@{EINA\_MAGIC\_NONE}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{EINA\_MAGIC\_NONE}{EINA\_MAGIC\_NONE}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+MAGIC\+\_\+\+NONE~0x1234fedc}



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

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

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \mbox{\hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{EINA\+\_\+\+MAGIC\+\_\+\+NONE}} is just {\ttfamily 0}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples]\par
\mbox{\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}}.\end{Desc}
\mbox{\Hypertarget{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}\label{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}} 
\index{Magic@{Magic}!EINA\_MAGIC@{EINA\_MAGIC}}
\index{EINA\_MAGIC@{EINA\_MAGIC}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{EINA\_MAGIC}{EINA\_MAGIC}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+MAGIC~\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}} \+\_\+\+\_\+magic;}



Definition of of a variable of type \mbox{\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}{0}
\DoxyCodeLine{\textcolor{keyword}{struct\ }Foo}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\_MAGIC}}}
\DoxyCodeLine{\};}

\end{DoxyCode}


\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\+\_\+\+MAGIC}} does nothing. 
\end{DoxyNote}
\begin{Desc}
\item[Examples]\par
\mbox{\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}!EINA\_MAGIC\_SET@{EINA\_MAGIC\_SET}}
\index{EINA\_MAGIC\_SET@{EINA\_MAGIC\_SET}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{EINA\_MAGIC\_SET}{EINA\_MAGIC\_SET}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+MAGIC\+\_\+\+SET(\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 \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\+\_\+\+MAGIC}} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \mbox{\hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{EINA\+\_\+\+MAGIC\+\_\+\+CHECK}} is just the value {\ttfamily 0}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples]\par
\mbox{\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}}.\end{Desc}
\mbox{\Hypertarget{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}\label{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}} 
\index{Magic@{Magic}!EINA\_MAGIC\_CHECK@{EINA\_MAGIC\_CHECK}}
\index{EINA\_MAGIC\_CHECK@{EINA\_MAGIC\_CHECK}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{EINA\_MAGIC\_CHECK}{EINA\_MAGIC\_CHECK}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+MAGIC\+\_\+\+CHECK(\begin{DoxyParamCaption}\item[{}]{d,  }\item[{}]{m }\end{DoxyParamCaption})~(\mbox{\hyperlink{group__Eina__Types__Group_gaa9820797ec4c069e571f57e3c0c12216}{EINA\+\_\+\+LIKELY}}((d) \&\& ((d)-\/$>$\+\_\+\+\_\+magic == (m))))}



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

{\ttfamily d} must be a structure that holds an Eina magic number declaration. Use \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\+\_\+\+MAGIC}} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \mbox{\hyperlink{group__Eina__Magic__Group_ga13317919a91b35412b6f40ca1166b373}{EINA\+\_\+\+MAGIC\+\_\+\+CHECK}} is just the value {\ttfamily 1}. 
\end{DoxyNote}
\begin{Desc}
\item[Examples]\par
\mbox{\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}}.\end{Desc}
\mbox{\Hypertarget{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}\label{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}} 
\index{Magic@{Magic}!EINA\_MAGIC\_FAIL@{EINA\_MAGIC\_FAIL}}
\index{EINA\_MAGIC\_FAIL@{EINA\_MAGIC\_FAIL}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{EINA\_MAGIC\_FAIL}{EINA\_MAGIC\_FAIL}}
{\footnotesize\ttfamily \#define EINA\+\_\+\+MAGIC\+\_\+\+FAIL(\begin{DoxyParamCaption}\item[{}]{d,  }\item[{}]{m }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\ \ \mbox{\hyperlink{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}{eina\_magic\_fail}}((\textcolor{keywordtype}{void}\ *)(d),\ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (d)\ ?\ (d)-\/>\_\_magic\ :\ 0,\ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (m),\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_\_FILE\_\_,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_\_func\_\_,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_\_LINE\_\_);}

\end{DoxyCode}


Definition to call \mbox{\hyperlink{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}{eina\+\_\+magic\+\_\+fail()}} with the parameters {\ttfamily d}, {\ttfamily d-\/\texorpdfstring{$>$}{>}\+\_\+\+\_\+magic}, {\ttfamily m}, {\bfseries{FILE}}, {\bfseries{func}}, and {\bfseries{LINE}}. 

{\ttfamily d} must be a structure that holds an Eina magic number declaration. Use \mbox{\hyperlink{group__Eina__Magic__Group_ga4085afe8dc73c98ae626cc952c69c668}{EINA\+\_\+\+MAGIC}} to add such a declaration.

\begin{DoxyNote}{Note}
If the magic feature of Eina is disabled, \mbox{\hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{EINA\+\_\+\+MAGIC\+\_\+\+FAIL}} does nothing. 
\end{DoxyNote}
\begin{Desc}
\item[Examples]\par
\mbox{\hyperlink{eina_magic_01_8c-example}{eina\+\_\+magic\+\_\+01.\+c}}.\end{Desc}


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



Gets the string associated with the given magic identifier. 

This function returns the string associated to {\ttfamily magic}. Even if none are found this function still returns non {\ttfamily NULL}, in this case an identifier such as \char`\"{}(none)\char`\"{}, \char`\"{}(undefined)\char`\"{}, or \char`\"{}(unknown)\char`\"{}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em magic} & The magic identifier \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The string associated to the identifier
\end{DoxyReturn}
\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 \mbox{\hyperlink{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}{eina\+\_\+magic\+\_\+fail()}}.

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



Sets the string associated with the given magic identifier. 

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{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em magic} & The magic identifier \\
\hline
\mbox{\texttt{ in}}  & {\em magic\+\_\+name} & The string associated with the identifier, must not be {\ttfamily NULL} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} on success, otherwise \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} on failure
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Magic__Group_ga045b40787a82c640980bf331cecc4205}{eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set()}} 
\end{DoxySeeAlso}


References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.



Referenced by \mbox{\hyperlink{group__Eldbus__Core_gadd7c8b8a43b5dd590f7fd06166288754}{eldbus\+\_\+init()}}.

\mbox{\Hypertarget{group__Eina__Magic__Group_ga045b40787a82c640980bf331cecc4205}\label{group__Eina__Magic__Group_ga045b40787a82c640980bf331cecc4205}} 
\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}}
\doxysubsubsection{\texorpdfstring{eina\_magic\_string\_static\_set()}{eina\_magic\_string\_static\_set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+magic\+\_\+string\+\_\+static\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}}]{magic,  }\item[{const char $\ast$}]{magic\+\_\+name }\end{DoxyParamCaption})}



Sets the string associated with the given magic identifier. 

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{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em magic} & The magic identifier \\
\hline
\mbox{\texttt{ in}}  & {\em magic\+\_\+name} & The string associated with the identifier, must not be {\ttfamily NULL} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}} on success, otherwise \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}} on failure
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Magic__Group_ga977e1491bee34a57366e263e7dbab6df}{eina\+\_\+magic\+\_\+string\+\_\+set()}} 
\end{DoxySeeAlso}


References \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\+\_\+\+FALSE}}, \mbox{\hyperlink{group__Eina__Safety__Checks__Group_gab2b07061fc6500dedd9cd41c8d16f95d}{EINA\+\_\+\+SAFETY\+\_\+\+ON\+\_\+\+NULL\+\_\+\+RETURN\+\_\+\+VAL}}, and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\+\_\+\+TRUE}}.

\mbox{\Hypertarget{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}\label{group__Eina__Magic__Group_ga29c2ead51c573075553181df8a7e4dd8}} 
\index{Magic@{Magic}!eina\_magic\_fail@{eina\_magic\_fail}}
\index{eina\_magic\_fail@{eina\_magic\_fail}!Magic@{Magic}}
\doxysubsubsection{\texorpdfstring{eina\_magic\_fail()}{eina\_magic\_fail()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Eina__Types__Group_ga6ac08753ba12bc9c7a0390cf67868f4f}{EINA\+\_\+\+API}} void eina\+\_\+magic\+\_\+fail (\begin{DoxyParamCaption}\item[{void $\ast$}]{d,  }\item[{\mbox{\hyperlink{group__Eina__Magic__Group_ga979d40af6182a8ec32890ba85df88f1d}{Eina\+\_\+\+Magic}}}]{m,  }\item[{\mbox{\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. 

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 NULL}, a message warns about a {\ttfamily NULL} pointer. \item Otherwise, if {\ttfamily m} is equal to \mbox{\hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{EINA\+\_\+\+MAGIC\+\_\+\+NONE}}, 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{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em d} & The checked data pointer \\
\hline
\mbox{\texttt{ in}}  & {\em m} & The magic identifier to check \\
\hline
\mbox{\texttt{ in}}  & {\em req\+\_\+m} & The requested magic identifier to check \\
\hline
\mbox{\texttt{ in}}  & {\em file} & The file in which the magic check failed \\
\hline
\mbox{\texttt{ in}}  & {\em fnc} & The function in which the magic check failed \\
\hline
\mbox{\texttt{ in}}  & {\em line} & The line at which the magic check failed\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{Warning}
You should {\bfseries{strongly}} consider using \mbox{\hyperlink{group__Eina__Magic__Group_gad7411adf9ff7121ad2004046f1b08408}{EINA\+\_\+\+MAGIC\+\_\+\+FAIL(d, m)}} instead.
\end{DoxyWarning}
\begin{DoxyNote}{Note}
If the environment variable EINA\+\_\+\+LOG\+\_\+\+ABORT is set, abort() is called and the program stops. It is useful for debugging programs with gdb. 
\end{DoxyNote}


References \mbox{\hyperlink{group__Eina__Log__Group_ga18ec560abe5eab504b812f892812b731}{EINA\+\_\+\+LOG\+\_\+\+DOMAIN\+\_\+\+GLOBAL}}, \mbox{\hyperlink{group__Eina__Log__Group_gga326699509b2e7578ace7c0a15b4a8c1aa620ee82716c2c262ad2929823cf24ebd}{EINA\+\_\+\+LOG\+\_\+\+LEVEL\+\_\+\+CRITICAL}}, \mbox{\hyperlink{group__Eina__Log__Group_gga326699509b2e7578ace7c0a15b4a8c1aa8252243003214c2e38a3b228fc85eb80}{EINA\+\_\+\+LOG\+\_\+\+LEVEL\+\_\+\+ERR}}, \mbox{\hyperlink{group__Eina__Magic__Group_ga087a0d5a1e482da550b33fe4fcb0435f}{EINA\+\_\+\+MAGIC\+\_\+\+NONE}}, and \mbox{\hyperlink{group__Eina__Magic__Group_gae60262e80f5ebf7961ffe904b45e3877}{eina\+\_\+magic\+\_\+string\+\_\+get()}}.

