\section{General purpose utility functions} \label{group__util}\index{General purpose utility functions@{General purpose utility functions}} \subsection*{Utility functions} \begin{CompactItemize} \item void \textbf{xfree} (void $\ast$)\label{group__util_g35c4383ff0dee2de18985e6edfed1ae6} \item char $\ast$ \textbf{xstrdup} (const char $\ast$)\label{group__util_g2961ae74e91b0b28acdf9822438a581c} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item void $\ast$ {\bf xmalloc} (size\_\-t size) \item void $\ast$ {\bf xrealloc} (void $\ast$p, size\_\-t size) \item char $\ast$ {\bf mm\_\-unquote} (const char $\ast$string) \item char $\ast$ {\bf mm\_\-uncomment} (const char $\ast$string) \item char $\ast$ {\bf xstrsep} (char $\ast$$\ast$stringp, const char $\ast$delim) \item char $\ast$ {\bf mm\_\-stripchars} (char $\ast$input, char $\ast$strip) \item char $\ast$ {\bf mm\_\-addchars} (char $\ast$input, char $\ast$add, u\_\-int16\_\-t linelength) \end{CompactItemize} \subsection{Function Documentation} \index{util@{util}!mm_addchars@{mm\_\-addchars}} \index{mm_addchars@{mm\_\-addchars}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-addchars (char $\ast$ {\em input}, char $\ast$ {\em add}, u\_\-int16\_\-t {\em linelength})}\label{group__util_g0747d4b4e33644263e6d73d2d8d4818b} Adds characters to a string at given positions \begin{Desc} \item[Parameters:] \begin{description} \item[{\em input}]The string to which to add characters \item[{\em add}]The character string to add \item[{\em linelength}]The position where to add the character \end{description} \end{Desc} \begin{Desc} \item[Returns:]A copy of the string with characters added\end{Desc} This function adds the characters add at each linelength positions and returns this new string. \index{util@{util}!mm_stripchars@{mm\_\-stripchars}} \index{mm_stripchars@{mm\_\-stripchars}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-stripchars (char $\ast$ {\em input}, char $\ast$ {\em strip})}\label{group__util_gf62be7dd21e545f8db72f3c9e3b6a3c3} Strips a given character set from a string \begin{Desc} \item[Parameters:] \begin{description} \item[{\em input}]The string which to strip \item[{\em strip}]The character set to strip off \end{description} \end{Desc} \begin{Desc} \item[Returns:]A copy of the original string with all chars stripped \end{Desc} \index{util@{util}!mm_uncomment@{mm\_\-uncomment}} \index{mm_uncomment@{mm\_\-uncomment}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-uncomment (const char $\ast$ {\em string})}\label{group__util_g49c016ff4cfd02f1b019c4dce5aac357} Removes MIME comments from a string \begin{Desc} \item[Parameters:] \begin{description} \item[{\em string}]The string to uncomment \end{description} \end{Desc} \begin{Desc} \item[Returns:]A pointer to the uncommented string or NULL on error. Sets mm\_\-errno.\end{Desc} This function removes MIME comments from a string (included in parantheses). It returns a pointer to a newly allocated memory region in which the uncommented string is stored. The returned string needs to be freed when it's not used anymore. \index{util@{util}!mm_unquote@{mm\_\-unquote}} \index{mm_unquote@{mm\_\-unquote}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mm\_\-unquote (const char $\ast$ {\em string})}\label{group__util_gf0f89a29a634f6f1f833abb1e214a6b1} Unquotes a string \begin{Desc} \item[Parameters:] \begin{description} \item[{\em string}]The quoted string to unquote \end{description} \end{Desc} \begin{Desc} \item[Returns:]A pointer to the unquoted string\end{Desc} This function unquotes a string. That is, it returns a pointer to a newly allocated memory region in which the unquoted string is stored. Only leading and trailing double-qoutes are removed. The string needs to be freed when it is not needed anymore. \index{util@{util}!xmalloc@{xmalloc}} \index{xmalloc@{xmalloc}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ xmalloc (size\_\-t {\em size})}\label{group__util_g2ff4ef58da7e543466e75f20f2a2d8b7} Allocates a block of memory \begin{Desc} \item[Parameters:] \begin{description} \item[{\em size}]The size of the memory region to allocate \end{description} \end{Desc} \begin{Desc} \item[Returns:]A pointer to the allocated memory region\end{Desc} \doxyref{xmalloc()}{p.}{group__util_g2ff4ef58da7e543466e75f20f2a2d8b7} calls abort() if either the size argument is negative or the requested memory amount could not be allocated via an assert() call. \index{util@{util}!xrealloc@{xrealloc}} \index{xrealloc@{xrealloc}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ xrealloc (void $\ast$ {\em p}, size\_\-t {\em size})}\label{group__util_ge14637b4672461f1f0bee822406d68dc} realloc() wrapper \begin{Desc} \item[Parameters:] \begin{description} \item[{\em p}]Pointer to a memory region which should be reallocated \item[{\em size}]The new size of the memory region \end{description} \end{Desc} \begin{Desc} \item[Returns:]A pointer to the reallocated memory region\end{Desc} \doxyref{xrealloc()}{p.}{group__util_ge14637b4672461f1f0bee822406d68dc} is a wrapper around realloc() which calls abort() if either the size argument is negative or the requested memory amount could not be allocated. \index{util@{util}!xstrsep@{xstrsep}} \index{xstrsep@{xstrsep}!util@{util}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ xstrsep (char $\ast$$\ast$ {\em stringp}, const char $\ast$ {\em delim})}\label{group__util_g3ae25483c8a42f6562f2a916a511228f} separate strings \begin{Desc} \item[Parameters:] \begin{description} \item[{\em stringp}]A pointer to the string being splitted \item[{\em delim}]The delimeter string\end{description} \end{Desc} This function works similar to strsep(), with the difference that delim is treated as a whole.