\hypertarget{lmem_8h}{
\section{lmem.h File Reference}
\label{lmem_8h}\index{lmem.h@{lmem.h}}
}
{\tt \#include $<$stddef.h$>$}\par
{\tt \#include \char`\"{}llimits.h\char`\"{}}\par
{\tt \#include \char`\"{}lua.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{lmem_8h_36d62c6c0c5a33c2f29cf26ff9137cbf}{MEMERRMSG}~\char`\"{}not enough memory\char`\"{}
\item 
\#define \hyperlink{lmem_8h_59142036ad6560a542668fbb8f74d7d2}{luaM\_\-reallocv}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, b, on, n, e)
\item 
\#define \hyperlink{lmem_8h_159fd0a4f45c4aa195990526f9d0bf01}{luaM\_\-freemem}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, b, s)~luaM\_\-realloc\_\-(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, (b), (s), 0)
\item 
\#define \hyperlink{lmem_8h_d927ceb6a17a9e89a00b83dcc4482988}{luaM\_\-free}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, b)~luaM\_\-realloc\_\-(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, (b), sizeof($\ast$(b)), 0)
\item 
\#define \hyperlink{lmem_8h_0e7e8302eb92be56c1043f086deed39a}{luaM\_\-freearray}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, b, n, t)~luaM\_\-reallocv(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, (b), n, 0, sizeof(t))
\item 
\#define \hyperlink{lmem_8h_352102a0627666bfc7f22209c1a7027d}{luaM\_\-malloc}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, t)~luaM\_\-realloc\_\-(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, NULL, 0, (t))
\item 
\#define \hyperlink{lmem_8h_e72bd363be924fa9a67be67de0802ad7}{luaM\_\-new}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, t)~cast(t $\ast$, luaM\_\-malloc(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, sizeof(t)))
\item 
\#define \hyperlink{lmem_8h_715cc368a85506c7a104cda58f270f3e}{luaM\_\-newvector}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, n, t)~cast(t $\ast$, luaM\_\-reallocv(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, NULL, 0, n, sizeof(t)))
\item 
\#define \hyperlink{lmem_8h_38823c4cdf0d53b73e1e3015affb06f9}{luaM\_\-growvector}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, v, nelems, size, t, limit, e)
\item 
\#define \hyperlink{lmem_8h_b1174e625ed7a62e5f8ba33a7e1c1917}{luaM\_\-reallocvector}(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, v, oldn, n, t)~((v)=cast(t $\ast$, luaM\_\-reallocv(\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, v, oldn, n, sizeof(t))))
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
LUAI\_\-FUNC void $\ast$ \hyperlink{lmem_8h_e7dc8a57fc5dbca825653a88a356a72d}{luaM\_\-realloc\_\-} (\hyperlink{structlua__State}{lua\_\-State} $\ast$\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, void $\ast$block, size\_\-t oldsize, size\_\-t size)
\item 
LUAI\_\-FUNC void $\ast$ \hyperlink{lmem_8h_4fecb596d14258a3c209eea3e7d91ab6}{luaM\_\-toobig} (\hyperlink{structlua__State}{lua\_\-State} $\ast$\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L})
\item 
LUAI\_\-FUNC void $\ast$ \hyperlink{lmem_8h_d168a6b3957fb05015268c46341547be}{luaM\_\-growaux\_\-} (\hyperlink{structlua__State}{lua\_\-State} $\ast$\hyperlink{main_8c_62f94dfc0036bec0c14106c2f15caf3e}{L}, void $\ast$block, int $\ast$size, size\_\-t size\_\-elem, int limit, const char $\ast$errormsg)
\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{lmem_8h_d927ceb6a17a9e89a00b83dcc4482988}{
\index{lmem.h@{lmem.h}!luaM\_\-free@{luaM\_\-free}}
\index{luaM\_\-free@{luaM\_\-free}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-free({\bf L}, \/  b)~luaM\_\-realloc\_\-({\bf L}, (b), sizeof($\ast$(b)), 0)}}
\label{lmem_8h_d927ceb6a17a9e89a00b83dcc4482988}


\hypertarget{lmem_8h_0e7e8302eb92be56c1043f086deed39a}{
\index{lmem.h@{lmem.h}!luaM\_\-freearray@{luaM\_\-freearray}}
\index{luaM\_\-freearray@{luaM\_\-freearray}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-freearray({\bf L}, \/  b, \/  n, \/  t)~luaM\_\-reallocv({\bf L}, (b), n, 0, sizeof(t))}}
\label{lmem_8h_0e7e8302eb92be56c1043f086deed39a}


\hypertarget{lmem_8h_159fd0a4f45c4aa195990526f9d0bf01}{
\index{lmem.h@{lmem.h}!luaM\_\-freemem@{luaM\_\-freemem}}
\index{luaM\_\-freemem@{luaM\_\-freemem}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-freemem({\bf L}, \/  b, \/  s)~luaM\_\-realloc\_\-({\bf L}, (b), (s), 0)}}
\label{lmem_8h_159fd0a4f45c4aa195990526f9d0bf01}


\hypertarget{lmem_8h_38823c4cdf0d53b73e1e3015affb06f9}{
\index{lmem.h@{lmem.h}!luaM\_\-growvector@{luaM\_\-growvector}}
\index{luaM\_\-growvector@{luaM\_\-growvector}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-growvector({\bf L}, \/  v, \/  nelems, \/  size, \/  t, \/  limit, \/  e)}}
\label{lmem_8h_38823c4cdf0d53b73e1e3015affb06f9}


\textbf{Value:}

\begin{Code}\begin{verbatim}if ((nelems)+1 > (size)) \
            ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
\end{verbatim}
\end{Code}
\hypertarget{lmem_8h_352102a0627666bfc7f22209c1a7027d}{
\index{lmem.h@{lmem.h}!luaM\_\-malloc@{luaM\_\-malloc}}
\index{luaM\_\-malloc@{luaM\_\-malloc}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-malloc({\bf L}, \/  t)~luaM\_\-realloc\_\-({\bf L}, NULL, 0, (t))}}
\label{lmem_8h_352102a0627666bfc7f22209c1a7027d}


\hypertarget{lmem_8h_e72bd363be924fa9a67be67de0802ad7}{
\index{lmem.h@{lmem.h}!luaM\_\-new@{luaM\_\-new}}
\index{luaM\_\-new@{luaM\_\-new}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-new({\bf L}, \/  t)~cast(t $\ast$, luaM\_\-malloc({\bf L}, sizeof(t)))}}
\label{lmem_8h_e72bd363be924fa9a67be67de0802ad7}


\hypertarget{lmem_8h_715cc368a85506c7a104cda58f270f3e}{
\index{lmem.h@{lmem.h}!luaM\_\-newvector@{luaM\_\-newvector}}
\index{luaM\_\-newvector@{luaM\_\-newvector}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-newvector({\bf L}, \/  n, \/  t)~cast(t $\ast$, luaM\_\-reallocv({\bf L}, NULL, 0, n, sizeof(t)))}}
\label{lmem_8h_715cc368a85506c7a104cda58f270f3e}


\hypertarget{lmem_8h_59142036ad6560a542668fbb8f74d7d2}{
\index{lmem.h@{lmem.h}!luaM\_\-reallocv@{luaM\_\-reallocv}}
\index{luaM\_\-reallocv@{luaM\_\-reallocv}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-reallocv({\bf L}, \/  b, \/  on, \/  n, \/  e)}}
\label{lmem_8h_59142036ad6560a542668fbb8f74d7d2}


\textbf{Value:}

\begin{Code}\begin{verbatim}((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ?  /* +1 to avoid warnings */ \
                luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \
                luaM_toobig(L))
\end{verbatim}
\end{Code}
\hypertarget{lmem_8h_b1174e625ed7a62e5f8ba33a7e1c1917}{
\index{lmem.h@{lmem.h}!luaM\_\-reallocvector@{luaM\_\-reallocvector}}
\index{luaM\_\-reallocvector@{luaM\_\-reallocvector}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define luaM\_\-reallocvector({\bf L}, \/  v, \/  oldn, \/  n, \/  t)~((v)=cast(t $\ast$, luaM\_\-reallocv({\bf L}, v, oldn, n, sizeof(t))))}}
\label{lmem_8h_b1174e625ed7a62e5f8ba33a7e1c1917}


\hypertarget{lmem_8h_36d62c6c0c5a33c2f29cf26ff9137cbf}{
\index{lmem.h@{lmem.h}!MEMERRMSG@{MEMERRMSG}}
\index{MEMERRMSG@{MEMERRMSG}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MEMERRMSG~\char`\"{}not enough memory\char`\"{}}}
\label{lmem_8h_36d62c6c0c5a33c2f29cf26ff9137cbf}




\subsection{Function Documentation}
\hypertarget{lmem_8h_d168a6b3957fb05015268c46341547be}{
\index{lmem.h@{lmem.h}!luaM\_\-growaux\_\-@{luaM\_\-growaux\_\-}}
\index{luaM\_\-growaux\_\-@{luaM\_\-growaux\_\-}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}LUAI\_\-FUNC void$\ast$ luaM\_\-growaux\_\- ({\bf lua\_\-State} $\ast$ {\em L}, \/  void $\ast$ {\em block}, \/  int $\ast$ {\em size}, \/  size\_\-t {\em size\_\-elem}, \/  int {\em limit}, \/  const char $\ast$ {\em errormsg})}}
\label{lmem_8h_d168a6b3957fb05015268c46341547be}


\hypertarget{lmem_8h_e7dc8a57fc5dbca825653a88a356a72d}{
\index{lmem.h@{lmem.h}!luaM\_\-realloc\_\-@{luaM\_\-realloc\_\-}}
\index{luaM\_\-realloc\_\-@{luaM\_\-realloc\_\-}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}LUAI\_\-FUNC void$\ast$ luaM\_\-realloc\_\- ({\bf lua\_\-State} $\ast$ {\em L}, \/  void $\ast$ {\em block}, \/  size\_\-t {\em oldsize}, \/  size\_\-t {\em size})}}
\label{lmem_8h_e7dc8a57fc5dbca825653a88a356a72d}


\hypertarget{lmem_8h_4fecb596d14258a3c209eea3e7d91ab6}{
\index{lmem.h@{lmem.h}!luaM\_\-toobig@{luaM\_\-toobig}}
\index{luaM\_\-toobig@{luaM\_\-toobig}!lmem.h@{lmem.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}LUAI\_\-FUNC void$\ast$ luaM\_\-toobig ({\bf lua\_\-State} $\ast$ {\em L})}}
\label{lmem_8h_4fecb596d14258a3c209eea3e7d91ab6}


