\doxysection{include/sphinxbase/ckd\+\_\+alloc.h File Reference}
\label{ckd__alloc_8h}\index{include/sphinxbase/ckd\_alloc.h@{include/sphinxbase/ckd\_alloc.h}}


Sphinx\textquotesingle{}s memory allocation/deallocation routines.  


{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$setjmp.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ ckd\+\_\+calloc}(n,  sz)~\+\_\+\+\_\+ckd\+\_\+calloc\+\_\+\+\_\+((n),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macros to simplify the use of above functions. \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+malloc}(sz)~\+\_\+\+\_\+ckd\+\_\+malloc\+\_\+\+\_\+((sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+malloc}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+realloc}(ptr,  sz)~\+\_\+\+\_\+ckd\+\_\+realloc\+\_\+\+\_\+(ptr,(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+realloc}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+salloc}(ptr)~\textbf{ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+}(ptr,\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+salloc}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+calloc\+\_\+2d}(d1,  d2,  sz)~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+}((d1),(d2),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+calloc\+\_\+2d}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+calloc\+\_\+3d}(d1,  d2,  d3,  sz)~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+}((d1),(d2),(d3),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+calloc\+\_\+3d}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+calloc\+\_\+4d}(d1,  d2,  d3,  d4,  s)~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+}((d1), (d2), (d3), (d4), (s), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+calloc\+\_\+4d}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+alloc\+\_\+2d\+\_\+ptr}(d1,  d2,  bf,  sz)~\textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr}((d1), (d2), (bf), (sz), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+alloc\+\_\+2d\+\_\+ptr}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+free\+\_\+2d\+\_\+ptr}(bf)~\textbf{ ckd\+\_\+free}(bf)
\begin{DoxyCompactList}\small\item\em Free only the pointer arrays allocated with \doxyref{ckd\+\_\+alloc\+\_\+2d\+\_\+ptr()}{p.}{ckd__alloc_8h_ad5d0dce212e97207af42803a3add00e1}. \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+alloc\+\_\+3d\+\_\+ptr}(d1,  d2,  d3,  bf,  sz)~\textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr}((d1), (d2), (d3), (bf), (sz), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\begin{DoxyCompactList}\small\item\em Macro for {\bfseries{ckd\+\_\+alloc\+\_\+3d\+\_\+ptr}} \end{DoxyCompactList}\item 
\#define \textbf{ ckd\+\_\+free\+\_\+3d\+\_\+ptr}(bf)~\textbf{ ckd\+\_\+free\+\_\+2d}(bf)
\begin{DoxyCompactList}\small\item\em Free only the pointer arrays allocated with \doxyref{ckd\+\_\+alloc\+\_\+3d\+\_\+ptr()}{p.}{ckd__alloc_8h_ab29a3fbbd58bc59aa2827eaeda090d06}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
jmp\+\_\+buf $\ast$ \textbf{ ckd\+\_\+set\+\_\+jump} (jmp\+\_\+buf $\ast$env, int abort)
\begin{DoxyCompactList}\small\item\em Control behaviour of the program when allocation fails. \end{DoxyCompactList}\item 
void \textbf{ ckd\+\_\+fail} (char $\ast$format,...)
\begin{DoxyCompactList}\small\item\em Fail (with a message) according to behaviour specified by \doxyref{ckd\+\_\+set\+\_\+jump()}{p.}{ckd__alloc_8h_a129b47f42c6be715a029a979cbfba20d}. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+\+\_\+} (size\+\_\+t n\+\_\+elem, size\+\_\+t elem\+\_\+size, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+malloc\+\_\+\+\_\+} (size\+\_\+t size, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+realloc\+\_\+\+\_\+} (void $\ast$ptr, size\+\_\+t new\+\_\+size, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\item 
SPHINXBASE\+\_\+\+EXPORT char $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+} (const char $\ast$origstr, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Like strdup, except that if an error occurs it prints a diagnostic message and exits. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+} (size\+\_\+t d1, size\+\_\+t d2, size\+\_\+t elemsize, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Allocate a 2-\/D array and return ptr to it (ie, ptr to vector of ptrs). \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+} (size\+\_\+t d1, size\+\_\+t d2, size\+\_\+t d3, size\+\_\+t elemsize, const char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Allocate a 3-\/D array and return ptr to it. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$$\ast$$\ast$$\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+} (size\+\_\+t d1, size\+\_\+t d2, size\+\_\+t d3, size\+\_\+t d4, size\+\_\+t elem\+\_\+size, char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Allocate a 34D array and return ptr to it. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr} (size\+\_\+t d1, size\+\_\+t d2, size\+\_\+t d3, void $\ast$store, size\+\_\+t elem\+\_\+size, char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Overlay a 3-\/D array over a previously allocated storage area. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void $\ast$ \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr} (size\+\_\+t d1, size\+\_\+t d2, void $\ast$store, size\+\_\+t elem\+\_\+size, char $\ast$caller\+\_\+file, int caller\+\_\+line)
\begin{DoxyCompactList}\small\item\em Overlay a s-\/D array over a previously allocated storage area. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ckd\+\_\+free} (void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Test and free a 1-\/D array. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ckd\+\_\+free\+\_\+2d} (void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Free a 2-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+2d. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ckd\+\_\+free\+\_\+3d} (void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Free a 3-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+3d. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ckd\+\_\+free\+\_\+4d} (void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Free a 4-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+4d. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Sphinx\textquotesingle{}s memory allocation/deallocation routines. 

Implementation of efficient memory allocation deallocation for multiple dimensional arrays. 

Definition in file \textbf{ ckd\+\_\+alloc.\+h}.



\doxysubsection{Macro Definition Documentation}
\label{ckd__alloc_8h_ad5d0dce212e97207af42803a3add00e1} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_alloc\_2d\_ptr@{ckd\_alloc\_2d\_ptr}}
\index{ckd\_alloc\_2d\_ptr@{ckd\_alloc\_2d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_alloc\_2d\_ptr}
{\footnotesize\ttfamily \#define ckd\+\_\+alloc\+\_\+2d\+\_\+ptr(\begin{DoxyParamCaption}\item[{}]{d1,  }\item[{}]{d2,  }\item[{}]{bf,  }\item[{}]{sz }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr}((d1), (d2), (bf), (sz), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+alloc\+\_\+2d\+\_\+ptr}} 



Definition at line \textbf{ 287} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_ab29a3fbbd58bc59aa2827eaeda090d06} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_alloc\_3d\_ptr@{ckd\_alloc\_3d\_ptr}}
\index{ckd\_alloc\_3d\_ptr@{ckd\_alloc\_3d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_alloc\_3d\_ptr}
{\footnotesize\ttfamily \#define ckd\+\_\+alloc\+\_\+3d\+\_\+ptr(\begin{DoxyParamCaption}\item[{}]{d1,  }\item[{}]{d2,  }\item[{}]{d3,  }\item[{}]{bf,  }\item[{}]{sz }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr}((d1), (d2), (d3), (bf), (sz), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+alloc\+\_\+3d\+\_\+ptr}} 



Definition at line \textbf{ 298} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_aa00ef21903bc4f8a972488417adc8d2e} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_calloc@{ckd\_calloc}}
\index{ckd\_calloc@{ckd\_calloc}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_calloc}
{\footnotesize\ttfamily \#define ckd\+\_\+calloc(\begin{DoxyParamCaption}\item[{}]{n,  }\item[{}]{sz }\end{DoxyParamCaption})~\+\_\+\+\_\+ckd\+\_\+calloc\+\_\+\+\_\+((n),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macros to simplify the use of above functions. 

One should use these, rather than target functions directly. Macro for {\bfseries{ckd\+\_\+calloc}} 

Definition at line \textbf{ 248} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_a949e7b50fcd9697b1563fa57f50e9c4f} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_calloc\_2d@{ckd\_calloc\_2d}}
\index{ckd\_calloc\_2d@{ckd\_calloc\_2d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_calloc\_2d}
{\footnotesize\ttfamily \#define ckd\+\_\+calloc\+\_\+2d(\begin{DoxyParamCaption}\item[{}]{d1,  }\item[{}]{d2,  }\item[{}]{sz }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+}((d1),(d2),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+calloc\+\_\+2d}} 



Definition at line \textbf{ 270} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_af716d69c9fbde1d8b2678da9c260ddc7} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_calloc\_3d@{ckd\_calloc\_3d}}
\index{ckd\_calloc\_3d@{ckd\_calloc\_3d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_calloc\_3d}
{\footnotesize\ttfamily \#define ckd\+\_\+calloc\+\_\+3d(\begin{DoxyParamCaption}\item[{}]{d1,  }\item[{}]{d2,  }\item[{}]{d3,  }\item[{}]{sz }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+}((d1),(d2),(d3),(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+calloc\+\_\+3d}} 



Definition at line \textbf{ 276} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_a5364600029b5bd488e41f29d6c5ffb11} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_calloc\_4d@{ckd\_calloc\_4d}}
\index{ckd\_calloc\_4d@{ckd\_calloc\_4d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_calloc\_4d}
{\footnotesize\ttfamily \#define ckd\+\_\+calloc\+\_\+4d(\begin{DoxyParamCaption}\item[{}]{d1,  }\item[{}]{d2,  }\item[{}]{d3,  }\item[{}]{d4,  }\item[{}]{s }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+}((d1), (d2), (d3), (d4), (s), \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+calloc\+\_\+4d}} 



Definition at line \textbf{ 281} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_a0afe1152d34da544602e6ab1635e05b1} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free\_2d\_ptr@{ckd\_free\_2d\_ptr}}
\index{ckd\_free\_2d\_ptr@{ckd\_free\_2d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free\_2d\_ptr}
{\footnotesize\ttfamily \#define ckd\+\_\+free\+\_\+2d\+\_\+ptr(\begin{DoxyParamCaption}\item[{}]{bf }\end{DoxyParamCaption})~\textbf{ ckd\+\_\+free}(bf)}



Free only the pointer arrays allocated with \doxyref{ckd\+\_\+alloc\+\_\+2d\+\_\+ptr()}{p.}{ckd__alloc_8h_ad5d0dce212e97207af42803a3add00e1}. 



Definition at line \textbf{ 292} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_af03a0583f358dbee5200910d151b490e} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free\_3d\_ptr@{ckd\_free\_3d\_ptr}}
\index{ckd\_free\_3d\_ptr@{ckd\_free\_3d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free\_3d\_ptr}
{\footnotesize\ttfamily \#define ckd\+\_\+free\+\_\+3d\+\_\+ptr(\begin{DoxyParamCaption}\item[{}]{bf }\end{DoxyParamCaption})~\textbf{ ckd\+\_\+free\+\_\+2d}(bf)}



Free only the pointer arrays allocated with \doxyref{ckd\+\_\+alloc\+\_\+3d\+\_\+ptr()}{p.}{ckd__alloc_8h_ab29a3fbbd58bc59aa2827eaeda090d06}. 



Definition at line \textbf{ 303} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_a8e89a31c3c70710a8e023a177084bff2} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_malloc@{ckd\_malloc}}
\index{ckd\_malloc@{ckd\_malloc}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_malloc}
{\footnotesize\ttfamily \#define ckd\+\_\+malloc(\begin{DoxyParamCaption}\item[{}]{sz }\end{DoxyParamCaption})~\+\_\+\+\_\+ckd\+\_\+malloc\+\_\+\+\_\+((sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+malloc}} 



Definition at line \textbf{ 253} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_afd496738b3e114bd494c5a0955f1bfb3} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_realloc@{ckd\_realloc}}
\index{ckd\_realloc@{ckd\_realloc}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_realloc}
{\footnotesize\ttfamily \#define ckd\+\_\+realloc(\begin{DoxyParamCaption}\item[{}]{ptr,  }\item[{}]{sz }\end{DoxyParamCaption})~\+\_\+\+\_\+ckd\+\_\+realloc\+\_\+\+\_\+(ptr,(sz),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+realloc}} 



Definition at line \textbf{ 258} of file \textbf{ ckd\+\_\+alloc.\+h}.

\label{ckd__alloc_8h_ad313f92478859f9e4ea99d0f6e78c393} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_salloc@{ckd\_salloc}}
\index{ckd\_salloc@{ckd\_salloc}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_salloc}
{\footnotesize\ttfamily \#define ckd\+\_\+salloc(\begin{DoxyParamCaption}\item[{}]{ptr }\end{DoxyParamCaption})~\textbf{ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+}(ptr,\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Macro for {\bfseries{ckd\+\_\+salloc}} 



Definition at line \textbf{ 264} of file \textbf{ ckd\+\_\+alloc.\+h}.



\doxysubsection{Function Documentation}
\label{ckd__alloc_8h_ae11553b6c0fd310ced4cbb25b1802d6f} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_alloc\_2d\_ptr@{\_\_ckd\_alloc\_2d\_ptr}}
\index{\_\_ckd\_alloc\_2d\_ptr@{\_\_ckd\_alloc\_2d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_alloc\_2d\_ptr()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{d1,  }\item[{size\+\_\+t}]{d2,  }\item[{void $\ast$}]{store,  }\item[{size\+\_\+t}]{elem\+\_\+size,  }\item[{char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Overlay a s-\/D array over a previously allocated storage area. 



Definition at line \textbf{ 405} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr()}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+2d\+\_\+ptr()}.

\label{ckd__alloc_8h_ab62c2d672319c75dbc27fa02ba11e592} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_alloc\_3d\_ptr@{\_\_ckd\_alloc\_3d\_ptr}}
\index{\_\_ckd\_alloc\_3d\_ptr@{\_\_ckd\_alloc\_3d\_ptr}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_alloc\_3d\_ptr()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{d1,  }\item[{size\+\_\+t}]{d2,  }\item[{size\+\_\+t}]{d3,  }\item[{void $\ast$}]{store,  }\item[{size\+\_\+t}]{elem\+\_\+size,  }\item[{char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Overlay a 3-\/D array over a previously allocated storage area. 



Definition at line \textbf{ 377} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr()}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+alloc\+\_\+3d\+\_\+ptr()}.

\label{ckd__alloc_8h_a0117c9d9c2de94eac7f2396b381f9fee} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_calloc\_2d\_\_@{\_\_ckd\_calloc\_2d\_\_}}
\index{\_\_ckd\_calloc\_2d\_\_@{\_\_ckd\_calloc\_2d\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_calloc\_2d\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{d1,  }\item[{size\+\_\+t}]{d2,  }\item[{size\+\_\+t}]{elemsize,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Allocate a 2-\/D array and return ptr to it (ie, ptr to vector of ptrs). 

The data area is allocated in one block so it can also be treated as a 1-\/D array. 

Definition at line \textbf{ 220} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+()}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+2d\+\_\+\+\_\+()}.

\label{ckd__alloc_8h_a7b885937e38ec79c93ad3a322e8d707d} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_calloc\_3d\_\_@{\_\_ckd\_calloc\_3d\_\_}}
\index{\_\_ckd\_calloc\_3d\_\_@{\_\_ckd\_calloc\_3d\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_calloc\_3d\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{d1,  }\item[{size\+\_\+t}]{d2,  }\item[{size\+\_\+t}]{d3,  }\item[{size\+\_\+t}]{elemsize,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Allocate a 3-\/D array and return ptr to it. 

The data area is allocated in one block so it can also be treated as a 1-\/D array. 

Definition at line \textbf{ 262} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+()}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+3d\+\_\+\+\_\+()}.

\label{ckd__alloc_8h_af7197ffa3bbdd1d19913f215636a37f5} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_calloc\_4d\_\_@{\_\_ckd\_calloc\_4d\_\_}}
\index{\_\_ckd\_calloc\_4d\_\_@{\_\_ckd\_calloc\_4d\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_calloc\_4d\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$$\ast$$\ast$$\ast$ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{d1,  }\item[{size\+\_\+t}]{d2,  }\item[{size\+\_\+t}]{d3,  }\item[{size\+\_\+t}]{d4,  }\item[{size\+\_\+t}]{elem\+\_\+size,  }\item[{char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Allocate a 34D array and return ptr to it. 

The data area is allocated in one block so it can also be treated as a 1-\/D array. 

Definition at line \textbf{ 307} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+()}, \textbf{ ckd\+\_\+calloc}, and \textbf{ E\+\_\+\+FATAL}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+4d\+\_\+\+\_\+()}.

\label{ckd__alloc_8h_aa5a87fb37c11b3ef278b3b21dae1634a} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_calloc\_\_@{\_\_ckd\_calloc\_\_}}
\index{\_\_ckd\_calloc\_\_@{\_\_ckd\_calloc\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_calloc\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+calloc\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{n\+\_\+elem,  }\item[{size\+\_\+t}]{elem\+\_\+size,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Definition at line \textbf{ 144} of file \textbf{ ckd\+\_\+alloc.\+c}.

\label{ckd__alloc_8h_a403f63fd755d9f1c5a988e82983f16ca} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_malloc\_\_@{\_\_ckd\_malloc\_\_}}
\index{\_\_ckd\_malloc\_\_@{\_\_ckd\_malloc\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_malloc\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+malloc\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{size,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Definition at line \textbf{ 169} of file \textbf{ ckd\+\_\+alloc.\+c}.

\label{ckd__alloc_8h_a48c6a4156f42d2b4d9e15d309cf9b1ac} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_realloc\_\_@{\_\_ckd\_realloc\_\_}}
\index{\_\_ckd\_realloc\_\_@{\_\_ckd\_realloc\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_realloc\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void $\ast$ \+\_\+\+\_\+ckd\+\_\+realloc\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr,  }\item[{size\+\_\+t}]{new\+\_\+size,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Definition at line \textbf{ 187} of file \textbf{ ckd\+\_\+alloc.\+c}.

\label{ckd__alloc_8h_a5cf960d610ad370a5dc65ed65ae39375} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!\_\_ckd\_salloc\_\_@{\_\_ckd\_salloc\_\_}}
\index{\_\_ckd\_salloc\_\_@{\_\_ckd\_salloc\_\_}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{\_\_ckd\_salloc\_\_()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT char $\ast$ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{const char $\ast$}]{origstr,  }\item[{const char $\ast$}]{caller\+\_\+file,  }\item[{int}]{caller\+\_\+line }\end{DoxyParamCaption})}



Like strdup, except that if an error occurs it prints a diagnostic message and exits. 



Definition at line \textbf{ 205} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+()}.



Referenced by \textbf{ \+\_\+\+\_\+ckd\+\_\+salloc\+\_\+\+\_\+()}.

\label{ckd__alloc_8h_ab81dfe13d2237c64182f06f66fab7b0e} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_fail@{ckd\_fail}}
\index{ckd\_fail@{ckd\_fail}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_fail()}
{\footnotesize\ttfamily void ckd\+\_\+fail (\begin{DoxyParamCaption}\item[{char $\ast$}]{format,  }\item[{}]{... }\end{DoxyParamCaption})}



Fail (with a message) according to behaviour specified by \doxyref{ckd\+\_\+set\+\_\+jump()}{p.}{ckd__alloc_8h_a129b47f42c6be715a029a979cbfba20d}. 



Definition at line \textbf{ 122} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+fail()}.



Referenced by \textbf{ ckd\+\_\+fail()}.

\label{ckd__alloc_8h_a31c6b405558620ac37599737b5722fbf} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free@{ckd\_free}}
\index{ckd\_free@{ckd\_free}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ckd\+\_\+free (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr }\end{DoxyParamCaption})}



Test and free a 1-\/D array. 



Definition at line \textbf{ 241} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ agc\+\_\+free()}, \textbf{ bio\+\_\+fwrite()}, \textbf{ bio\+\_\+hdrarg\+\_\+free()}, \textbf{ bio\+\_\+read\+\_\+wavfile()}, \textbf{ bit\+\_\+encode\+\_\+free()}, \textbf{ ckd\+\_\+free()}, \textbf{ ckd\+\_\+free\+\_\+2d()}, \textbf{ ckd\+\_\+free\+\_\+3d()}, \textbf{ ckd\+\_\+free\+\_\+4d()}, \textbf{ cmd\+\_\+ln\+\_\+free\+\_\+r()}, \textbf{ cmd\+\_\+ln\+\_\+parse\+\_\+file\+\_\+r()}, \textbf{ cmd\+\_\+ln\+\_\+set\+\_\+str\+\_\+r()}, \textbf{ feat\+\_\+array\+\_\+free()}, \textbf{ feat\+\_\+free()}, \textbf{ feat\+\_\+init()}, \textbf{ feat\+\_\+lda\+\_\+transform()}, \textbf{ feat\+\_\+s2mfc2feat()}, \textbf{ feat\+\_\+set\+\_\+subvecs()}, \textbf{ fopen\+\_\+comp()}, \textbf{ fopen\+\_\+compchk()}, \textbf{ glist\+\_\+free()}, \textbf{ gnode\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+delete\+\_\+bkey()}, \textbf{ hash\+\_\+table\+\_\+empty()}, \textbf{ hash\+\_\+table\+\_\+enter\+\_\+bkey()}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+iter\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+lookup\+\_\+bkey()}, \textbf{ hash\+\_\+table\+\_\+replace\+\_\+bkey()}, \textbf{ heap\+\_\+destroy()}, \textbf{ huff\+\_\+code\+\_\+free()}, \textbf{ jsgf\+\_\+grammar\+\_\+free()}, \textbf{ lineiter\+\_\+free()}, \textbf{ listelem\+\_\+alloc\+\_\+free()}, \textbf{ listelem\+\_\+alloc\+\_\+init()}, \textbf{ logmath\+\_\+free()}, \textbf{ mmio\+\_\+file\+\_\+unmap()}, \textbf{ ngram\+\_\+iter()}, \textbf{ ngram\+\_\+iter\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+read\+\_\+classdef()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+remove()}, \textbf{ ngram\+\_\+prob()}, \textbf{ ngram\+\_\+score()}, \textbf{ pctr\+\_\+free()}, \textbf{ sbevent\+\_\+free()}, \textbf{ sbevent\+\_\+init()}, \textbf{ sbmsgq\+\_\+free()}, \textbf{ sbmsgq\+\_\+init()}, \textbf{ sbmtx\+\_\+free()}, \textbf{ sbmtx\+\_\+init()}, \textbf{ sbthread\+\_\+free()}, \textbf{ subvecs\+\_\+free()}, and \textbf{ yin\+\_\+free()}.

\label{ckd__alloc_8h_a8246c071ac12e98b7e1df9fe6da15aef} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free\_2d@{ckd\_free\_2d}}
\index{ckd\_free\_2d@{ckd\_free\_2d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free\_2d()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ckd\+\_\+free\+\_\+2d (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr }\end{DoxyParamCaption})}



Free a 2-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+2d. 



Definition at line \textbf{ 252} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+free()}, and \textbf{ ckd\+\_\+free\+\_\+2d()}.



Referenced by \textbf{ ckd\+\_\+free\+\_\+2d()}, \textbf{ feat\+\_\+array\+\_\+free()}, \textbf{ feat\+\_\+free()}, \textbf{ feat\+\_\+s2mfc2feat()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+add()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words()}, and \textbf{ yin\+\_\+free()}.

\label{ckd__alloc_8h_a443accde4663a4a07c6d147088614d57} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free\_3d@{ckd\_free\_3d}}
\index{ckd\_free\_3d@{ckd\_free\_3d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free\_3d()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ckd\+\_\+free\+\_\+3d (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr }\end{DoxyParamCaption})}



Free a 3-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+3d. 



Definition at line \textbf{ 294} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+free()}, and \textbf{ ckd\+\_\+free\+\_\+3d()}.



Referenced by \textbf{ ckd\+\_\+free\+\_\+3d()}, \textbf{ feat\+\_\+free()}, and \textbf{ feat\+\_\+read\+\_\+lda()}.

\label{ckd__alloc_8h_a2fb0211c16bcbd89d932f383e28b9a7a} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_free\_4d@{ckd\_free\_4d}}
\index{ckd\_free\_4d@{ckd\_free\_4d}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_free\_4d()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ckd\+\_\+free\+\_\+4d (\begin{DoxyParamCaption}\item[{void $\ast$}]{ptr }\end{DoxyParamCaption})}



Free a 4-\/D array (ptr) previously allocated by ckd\+\_\+calloc\+\_\+4d. 



Definition at line \textbf{ 361} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+free()}, and \textbf{ ckd\+\_\+free\+\_\+4d()}.



Referenced by \textbf{ ckd\+\_\+free\+\_\+4d()}.

\label{ckd__alloc_8h_a129b47f42c6be715a029a979cbfba20d} 
\index{ckd\_alloc.h@{ckd\_alloc.h}!ckd\_set\_jump@{ckd\_set\_jump}}
\index{ckd\_set\_jump@{ckd\_set\_jump}!ckd\_alloc.h@{ckd\_alloc.h}}
\doxysubsubsection{ckd\_set\_jump()}
{\footnotesize\ttfamily jmp\+\_\+buf $\ast$ ckd\+\_\+set\+\_\+jump (\begin{DoxyParamCaption}\item[{jmp\+\_\+buf $\ast$}]{env,  }\item[{int}]{abort }\end{DoxyParamCaption})}



Control behaviour of the program when allocation fails. 

Although your program is probably toast when memory allocation fails, it is also probably a good idea to be able to catch these errors and alert the user in some way. Either that, or you might want the program to call abort() so that you can debug the failed code. This function allows you to control that behaviour.


\begin{DoxyParams}{Parameters}
{\em env} & Pointer to a {\ttfamily jmp\+\_\+buf} initialized with setjmp(), or NULL to remove a previously set jump target. \\
\hline
{\em abort} & If non-\/zero, the program will call abort() when allocation fails rather than exiting or calling longjmp(). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to a previously set {\ttfamily jmp\+\_\+buf}, if any. 
\end{DoxyReturn}


Definition at line \textbf{ 109} of file \textbf{ ckd\+\_\+alloc.\+c}.



References \textbf{ ckd\+\_\+set\+\_\+jump()}.



Referenced by \textbf{ ckd\+\_\+set\+\_\+jump()}.

