% This LaTeX file generated by cxref
% cxref program (c) Andrew M. Bishop 1995,96,97.

\markboth{File memory.c}{File memory.c}
\section{File memory.c}
\label{file_memory.c}

{\bf RCS Header: /home/amb/cxref/RCS/memory.c 1.12 1999/01/16 11:09:59 amb Exp }

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Memory management functions


\subsection*{Included Files}

\begin{cxreftabi}
{\stt \#include "autoconfig.h"} &\cxreffile{autoconfig.h}\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <stdio.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <stdlib.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <string.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <stdarg.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <memory.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include "memory.h"} &\cxreffile{memory.h}\\
\end{cxreftabi}


\subsection*{Preprocessor definitions}

 The amount of debugging, non-zero for totals, 2 for logging, 4 for printing each call. 

\smallskip
{\stt \#define DEBUG 0}

\medskip
 The size of each of the heap allocations 

\smallskip
{\stt \#define HEAP\_INC 8192}

\medskip
 The size of a string that is large enough to have it's own mallocation. 

\smallskip
{\stt \#define SMALL\_STRING 256}


\subsection{Type definitions}


\subsubsection{Typedef Heap}
\label{type_Heap_memory.c}

 A private memory heap is used to reduce the number of malloc calls that are made, the Heap type is a pointer to this. 

\smallskip
{\stt typedef struct \_Heap* Heap}

\smallskip
\begin{cxreftabii}
See:& Type struct \_Heap & \cxreftype{struct__Heap}{memory.c}\\
\end{cxreftabii}


\subsubsection{Type struct \_Heap}
\label{type_struct__Heap_memory.c}

 A structure containing all of the information about the private heap in a linked list. 

\smallskip
\smallskip
\begin{cxreftabiia}
\hspace*{0.0in}{\stt struct \_Heap} &\\
\hspace*{0.1in}{\stt \{} &\\
\hspace*{0.2in}{\stt char* mem;} &  The memory that is private to the heap.  \\
\hspace*{0.2in}{\stt Heap next;} &  The next Heap structure.  \\
\hspace*{0.1in}{\stt \}} &\\
\end{cxreftabiia}


\subsection{Variables}


\subsubsection{Local Variables}

{\bf first}
\label{var_first_memory.c}

 Local variable to control the usage of the private heap;   the first segment of memory on the private heap. 

\smallskip
{\stt static Heap first}

\smallskip
\begin{cxreftabiii}
Used in:\ & TidyMemory() & \ & \cxreffunc{TidyMemory}{memory.c}\\
\ & add\_to\_heap() & \ & \cxreffunc{add_to_heap}{memory.c}\\
\end{cxreftabiii}

\medskip
{\bf heap\_left}
\label{var_heap_left_memory.c}

 the amount of space left in the current heap segment. 

\smallskip
{\stt static int heap\_left}

\smallskip
\begin{cxreftabiii}
Used in:\ & TidyMemory() & \ & \cxreffunc{TidyMemory}{memory.c}\\
\ & get\_space() & \ & \cxreffunc{get_space}{memory.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function ConcatStrings()}
\label{func_ConcatStrings_memory.c}

  A function to concatenate a number of strings.

\smallskip
{\stt char* ConcatStrings ( int n, char* s, ... )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* ConcatStrings} Returns the a pointer to the new string.
\cxrefargitem{int n} The number of strings
\cxrefargitem{char* s} The first string.
\cxrefargitem{...} The other strings, 'n' including 's'.
\end{cxrefarglist}

\smallskip
  Any of the strings that are inputs can be NULL, in this case they are quietly ignored.

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & get\_space() & memory.c & \cxreffunc{get_space}{memory.c}\\
\ & \cxreftabiiispan{ strcat(), strlen()} &\\
Called by:\ & CreateAppendix() & xref.c & \cxreffunc{CreateAppendix}{xref.c}\\
\ & CrossReference() & xref.c & \cxreffunc{CrossReference}{xref.c}\\
\cxreftabbreak{cxreftabiii}
\ & CrossReferenceDelete() & xref.c & \cxreffunc{CrossReferenceDelete}{xref.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenFuncIntComment() & func.c & \cxreffunc{SeenFuncIntComment}{func.c}\\
\ & SeenFunctionDefinition() & func.c & \cxreffunc{SeenFunctionDefinition}{func.c}\\
\ & SeenInclude() & preproc.c & \cxreffunc{SeenInclude}{preproc.c}\\
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\ & WriteHTMLAppendix() & html.c & \cxreffunc{WriteHTMLAppendix}{html.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteHTMLDocument() & html.c & \cxreffunc{WriteHTMLDocument}{html.c}\\
\ & WriteHTMLFile() & html.c & \cxreffunc{WriteHTMLFile}{html.c}\\
\ & WriteHTMLFileDelete() & html.c & \cxreffunc{WriteHTMLFileDelete}{html.c}\\
\ & WriteHTMLSource() & html.c & \cxreffunc{WriteHTMLSource}{html.c}\\
\ & WriteLatexAppendix() & latex.c & \cxreffunc{WriteLatexAppendix}{latex.c}\\
\ & WriteLatexDocument() & latex.c & \cxreffunc{WriteLatexDocument}{latex.c}\\
\ & WriteLatexFile() & latex.c & \cxreffunc{WriteLatexFile}{latex.c}\\
\ & WriteLatexFileDelete() & latex.c & \cxreffunc{WriteLatexFileDelete}{latex.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteLatexTemplate() & latex.c & \cxreffunc{WriteLatexTemplate}{latex.c}\\
\ & WriteRTFAppendix() & rtf.c & \cxreffunc{WriteRTFAppendix}{rtf.c}\\
\ & WriteRTFFile() & rtf.c & \cxreffunc{WriteRTFFile}{rtf.c}\\
\ & WriteRTFFileDelete() & rtf.c & \cxreffunc{WriteRTFFileDelete}{rtf.c}\\
\ & WriteSGMLAppendix() & sgml.c & \cxreffunc{WriteSGMLAppendix}{sgml.c}\\
\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\ & WriteSGMLFileDelete() & sgml.c & \cxreffunc{WriteSGMLFileDelete}{sgml.c}\\
\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function CopyString()}
\label{func_CopyString_memory.c}

  A function to copy a string on the local private memory heap.

\smallskip
{\stt char* CopyString ( char* x )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* CopyString} Returns the copy of the string.
\cxrefargitem{char* x} The string to be copied.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & get\_space() & memory.c & \cxreffunc{get_space}{memory.c}\\
\ & \cxreftabiiispan{ strcpy(), strlen()} &\\
Called by:\ & ParseConfigFile() & cxref.c & \cxreffunc{ParseConfigFile}{cxref.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\cxreftabbreak{cxreftabiii}
\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function PrintMemoryStatistics()}
\label{func_PrintMemoryStatistics_memory.c}

  Prints out the number of mallocs / reallocs and frees.

\smallskip
{\stt void PrintMemoryStatistics ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SafeCalloc()}
\label{func_SafeCalloc_memory.c}

  A replacement calloc() function.

\smallskip
{\stt void* SafeCalloc ( unsigned int n, unsigned int size, char* file, int line )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{void* SafeCalloc} Returns the address.
\cxrefargitem{unsigned int n} The number of items to allocate.
\cxrefargitem{unsigned int size} The size of the memory to allocate.
\cxrefargitem{char* file} The file that the function is called from.
\cxrefargitem{int line} The line number that the function is called from.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & \cxreftabiiispan{ calloc(), printf()} &\\
Called by:\ & NewDefineType() & preproc.c & \cxreffunc{NewDefineType}{preproc.c}\\
\ & NewFile() & file.c & \cxreffunc{NewFile}{file.c}\\
\ & NewFunctionType() & func.c & \cxreffunc{NewFunctionType}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & NewIncludeType() & preproc.c & \cxreffunc{NewIncludeType}{preproc.c}\\
\ & NewStringList() & slist.c & \cxreffunc{NewStringList}{slist.c}\\
\ & NewStringList2() & slist.c & \cxreffunc{NewStringList2}{slist.c}\\
\ & NewStructUnionType() & type.c & \cxreffunc{NewStructUnionType}{type.c}\\
\ & NewTypedefType() & type.c & \cxreffunc{NewTypedefType}{type.c}\\
\ & NewVariableType() & var.c & \cxreffunc{NewVariableType}{var.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SafeFree()}
\label{func_SafeFree_memory.c}

  A replacement free() function.

\smallskip
{\stt void SafeFree ( void* ptr, char* file, int line )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{void* ptr} The pointer that is to be freed up.
\cxrefargitem{char* file} The file that the function is called from.
\cxrefargitem{int line} The line number that the function is called from.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & \cxreftabiiispan{ free(), printf()} &\\
Called by:\ & DeleteComment() & comment.c & \cxreffunc{DeleteComment}{comment.c}\\
\ & DeleteDefineType() & preproc.c & \cxreffunc{DeleteDefineType}{preproc.c}\\
\ & DeleteFile() & file.c & \cxreffunc{DeleteFile}{file.c}\\
\cxreftabbreak{cxreftabiii}
\ & DeleteFunctionType() & func.c & \cxreffunc{DeleteFunctionType}{func.c}\\
\ & DeleteIncludeType() & preproc.c & \cxreffunc{DeleteIncludeType}{preproc.c}\\
\ & DeleteStringList() & slist.c & \cxreffunc{DeleteStringList}{slist.c}\\
\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
\ & DeleteStructUnionType() & type.c & \cxreffunc{DeleteStructUnionType}{type.c}\\
\ & DeleteTypedefType() & type.c & \cxreffunc{DeleteTypedefType}{type.c}\\
\ & DeleteVariableType() & var.c & \cxreffunc{DeleteVariableType}{var.c}\\
\ & ParseConfigFile() & cxref.c & \cxreffunc{ParseConfigFile}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\ & ParseOptions() & cxref.c & \cxreffunc{ParseOptions}{cxref.c}\\
\ & ResetParser() & parse-yacc.c & \cxreffunc{ResetParser}{parse-yacc.c}\\
\ & ResetPreProcAnalyser() & preproc.c & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & ResetVariableAnalyser() & var.c & \cxreffunc{ResetVariableAnalyser}{var.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenFuncIntComment() & func.c & \cxreffunc{SeenFuncIntComment}{func.c}\\
\ & SeenFunctionArg() & func.c & \cxreffunc{SeenFunctionArg}{func.c}\\
\ & SeenFunctionDefinition() & func.c & \cxreffunc{SeenFunctionDefinition}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SeenVariableDefinition() & var.c & \cxreffunc{SeenVariableDefinition}{var.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\ & TidyMemory() & memory.c & \cxreffunc{TidyMemory}{memory.c}\\
\ & check\_for\_var\_func() & xref.c & \cxreffunc{check_for_var_func}{xref.c}\\
\ & fixup\_extern\_var() & xref.c & \cxreffunc{fixup_extern_var}{xref.c}\\
\ & html() & html.c & \cxreffunc{html}{html.c}\\
\ & latex() & latex.c & \cxreffunc{latex}{latex.c}\\
\cxreftabbreak{cxreftabiii}
\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\ & rtf() & rtf.c & \cxreffunc{rtf}{rtf.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SafeMalloc()}
\label{func_SafeMalloc_memory.c}

  A replacement malloc() function.

\smallskip
{\stt void* SafeMalloc ( unsigned int size, char* file, int line )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{void* SafeMalloc} Returns the address.
\cxrefargitem{unsigned int size} The size of the memory to allocate.
\cxrefargitem{char* file} The file that the function is called from.
\cxrefargitem{int line} The line number that the function is called from.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & \cxreftabiiispan{ malloc(), printf()} &\\
Called by:\ & AddToStringList() & slist.c & \cxreffunc{AddToStringList}{slist.c}\\
\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & ParseConfigFile() & cxref.c & \cxreffunc{ParseConfigFile}{cxref.c}\\
\ & ParseOptions() & cxref.c & \cxreffunc{ParseOptions}{cxref.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & SeenComment() & comment.c & \cxreffunc{SeenComment}{comment.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & UpScope() & var.c & \cxreffunc{UpScope}{var.c}\\
\ & add\_to\_heap() & memory.c & \cxreffunc{add_to_heap}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & html() & html.c & \cxreffunc{html}{html.c}\\
\ & latex() & latex.c & \cxreffunc{latex}{latex.c}\\
\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\ & push() & parse-yacc.c & \cxreffunc{push}{parse-yacc.c}\\
\ & rtf() & rtf.c & \cxreffunc{rtf}{rtf.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SafeMallocString()}
\label{func_SafeMallocString_memory.c}

  A function to copy a string on the public global heap.

\smallskip
{\stt char* SafeMallocString ( char* x, char* file, int line )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* SafeMallocString} Returns the copy of the string.
\cxrefargitem{char* x} The string to be copied.
\cxrefargitem{char* file} The file that the function is called from.
\cxrefargitem{int line} The line number that the function is called from.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\ & \cxreftabiiispan{ strcpy(), strlen()} &\\
Called by:\ & AddToStringList() & slist.c & \cxreffunc{AddToStringList}{slist.c}\\
\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\cxreftabbreak{cxreftabiii}
\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\ & NewDefineType() & preproc.c & \cxreffunc{NewDefineType}{preproc.c}\\
\ & NewFile() & file.c & \cxreffunc{NewFile}{file.c}\\
\ & NewFunctionType() & func.c & \cxreffunc{NewFunctionType}{func.c}\\
\ & NewIncludeType() & preproc.c & \cxreffunc{NewIncludeType}{preproc.c}\\
\ & NewStructUnionType() & type.c & \cxreffunc{NewStructUnionType}{type.c}\\
\ & NewTypedefType() & type.c & \cxreffunc{NewTypedefType}{type.c}\\
\ & NewVariableType() & var.c & \cxreffunc{NewVariableType}{var.c}\\
\cxreftabbreak{cxreftabiii}
\ & ParseOptions() & cxref.c & \cxreffunc{ParseOptions}{cxref.c}\\
\ & SeenDefine() & preproc.c & \cxreffunc{SeenDefine}{preproc.c}\\
\ & SeenDefineComment() & preproc.c & \cxreffunc{SeenDefineComment}{preproc.c}\\
\ & SeenDefineFuncArgComment() & preproc.c & \cxreffunc{SeenDefineFuncArgComment}{preproc.c}\\
\ & SeenDefineValue() & preproc.c & \cxreffunc{SeenDefineValue}{preproc.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenFileComment() & file.c & \cxreffunc{SeenFileComment}{file.c}\\
\ & SeenFuncIntComment() & func.c & \cxreffunc{SeenFuncIntComment}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenFunctionArg() & func.c & \cxreffunc{SeenFunctionArg}{func.c}\\
\ & SeenFunctionDeclaration() & func.c & \cxreffunc{SeenFunctionDeclaration}{func.c}\\
\ & SeenFunctionDefinition() & func.c & \cxreffunc{SeenFunctionDefinition}{func.c}\\
\ & SeenInclude() & preproc.c & \cxreffunc{SeenInclude}{preproc.c}\\
\ & SeenIncludeComment() & preproc.c & \cxreffunc{SeenIncludeComment}{preproc.c}\\
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SeenStructUnionStart() & type.c & \cxreffunc{SeenStructUnionStart}{type.c}\\
\ & SeenTypedef() & type.c & \cxreffunc{SeenTypedef}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenVariableDefinition() & var.c & \cxreffunc{SeenVariableDefinition}{var.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\ & check\_for\_caller() & xref.c & \cxreffunc{check_for_caller}{xref.c}\\
\ & check\_for\_var() & xref.c & \cxreffunc{check_for_var}{xref.c}\\
\ & check\_for\_var\_func() & xref.c & \cxreffunc{check_for_var_func}{xref.c}\\
\ & fixup\_extern\_var() & xref.c & \cxreffunc{fixup_extern_var}{xref.c}\\
\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SafeRealloc()}
\label{func_SafeRealloc_memory.c}

  A replacement realloc() function.

\smallskip
{\stt void* SafeRealloc ( void* ptr, unsigned int size, char* file, int line )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{void* SafeRealloc} Returns the address.
\cxrefargitem{void* ptr} The old pointer.
\cxrefargitem{unsigned int size} The size of the new memory to allocate.
\cxrefargitem{char* file} The file that the function is called from.
\cxrefargitem{int line} The line number that the function is called from.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & \cxreftabiiispan{ printf(), realloc()} &\\
Called by:\ & AddToStringList() & slist.c & \cxreffunc{AddToStringList}{slist.c}\\
\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & ParseConfigFile() & cxref.c & \cxreffunc{ParseConfigFile}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\ & ParseOptions() & cxref.c & \cxreffunc{ParseOptions}{cxref.c}\\
\ & SeenComment() & comment.c & \cxreffunc{SeenComment}{comment.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SetCurrentComment() & comment.c & \cxreffunc{SetCurrentComment}{comment.c}\\
\ & UpScope() & var.c & \cxreffunc{UpScope}{var.c}\\
\ & html() & html.c & \cxreffunc{html}{html.c}\\
\ & latex() & latex.c & \cxreffunc{latex}{latex.c}\\
\cxreftabbreak{cxreftabiii}
\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\ & push() & parse-yacc.c & \cxreffunc{push}{parse-yacc.c}\\
\ & rtf() & rtf.c & \cxreffunc{rtf}{rtf.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Global Function TidyMemory()}
\label{func_TidyMemory_memory.c}

  Tidies up the local heap of memory.

\smallskip
{\stt void TidyMemory ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.h & \ & \cxreffile{memory.h}\\
Calls:\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
Refs Var:\ & first & memory.c & \cxrefvar{first}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & heap\_left & memory.c & \cxrefvar{heap_left}{memory.c}\\
\end{cxreftabiii}


\subsubsection{Local Function add\_to\_heap()}
\label{func_add_to_heap_memory.c}

  Add some bytes to the privately maintained memory heap.

\smallskip
{\stt static Heap add\_to\_heap ( unsigned int l )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Heap add\_to\_heap} Returns a pointer to the required memory.
\cxrefargitem{unsigned int l} The size of the memory that is required.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.c & \ & \cxreffile{memory.c}\\
Calls:\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
Called by:\ & get\_space() & memory.c & \cxreffunc{get_space}{memory.c}\\
Refs Var:\ & first & memory.c & \cxrefvar{first}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Local Function get\_space()}
\label{func_get_space_memory.c}

  A function to get some memory for a string, allocate a new heap structure if needed.

\smallskip
{\stt static char* get\_space ( unsigned int l )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* get\_space} Returns a pointer to enough space.
\cxrefargitem{unsigned int l} The amount of space that is needed.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& memory.c & \ & \cxreffile{memory.c}\\
Calls:\ & add\_to\_heap() & memory.c & \cxreffunc{add_to_heap}{memory.c}\\
Called by:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & CopyString() & memory.c & \cxreffunc{CopyString}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & heap\_left & memory.c & \cxrefvar{heap_left}{memory.c}\\
\end{cxreftabiii}

