1 #include "csf.h"
2 #include "csfimpl.h"
3 
4 /* allocate dynamic memory large enough to hold in-file and app cells
5  * Rmalloc allocates memory to hold  nrOfCells
6  * cells in both the in-file and app cell representation. Allocation
7  * is done by malloc for other users. Our own (utrecht university) applications
8  * calls ChkMalloc. Freeing memory allocated by Rmalloc is done by free (or Free).
9  *
10  * NOTE
11  * Note that a possible RuseAs call must be done BEFORE Rmalloc.
12  *
13  * returns
14  * a pointer the allocated memory or
15  * NULL
16  * if the request fails
17  *
18  * example
19  * .so examples/_row.tr
20  */
Rmalloc(const MAP * m,size_t nrOfCells)21 void *Rmalloc(
22 	const MAP *m,      /* map handle */
23 	size_t nrOfCells)   /* number of cells allocated memory must hold */
24 {
25 	CSF_CR inFileCR = RgetCellRepr(m);
26 	CSF_CR largestCellRepr =
27 		LOG_CELLSIZE(m->appCR) > LOG_CELLSIZE(inFileCR)
28 		 ?  m->appCR : inFileCR;
29 
30 	return CSF_MALLOC((size_t)CSFSIZEOF(nrOfCells, largestCellRepr));
31 }
32