rmalloc.c

来自「支持各种栅格图像和矢量图像读取的库」· C语言 代码 · 共 35 行

C
35
字号
/* * rmalloc.c  */#include "csf.h"#include "csfimpl.h"/* allocate dynamic memory large enough to hold in-file and app cells * Rmalloc allocates memory to hold  nrOfCells  * cells in both the in-file and app cell representation. Allocation * is done by malloc for other users. Our own (utrecht university) applications * calls ChkMalloc. Freeing memory allocated by Rmalloc is done by free (or Free). * * NOTE * Note that a possible RuseAs call must be done BEFORE Rmalloc. * * returns * a pointer the allocated memory or * NULL * if the request fails * * example * .so examples/_row.tr */void *Rmalloc(	const MAP *m,      /* map handle */	size_t nrOfCells)   /* number of cells allocated memory must hold */{	CSF_CR inFileCR = RgetCellRepr(m);	CSF_CR largestCellRepr = 		LOG_CELLSIZE(m->appCR) > LOG_CELLSIZE(inFileCR) 		 ?  m->appCR : inFileCR;	return CSF_MALLOC((size_t)CSFSIZEOF(nrOfCells, largestCellRepr));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?