node *omalloc(void) {
    if (freelist isnt NULL) {
        return (node *)popFree((stack **)(&freelist));
    }
    setflag("ERROR in omalloc: NULL freelist");
    return NULL;
}
//
// Structure allocation
//
string *smalloc(void) {
    if (stringfreelist isnt NULL) {
        return (string *)popFree((stack **)(&stringfreelist));
    }
    setflag("ERROR in smalloc: NULL stringfreelist");
    return NULL;
}
namestr *nmalloc(void) {
    if (namefreelist isnt NULL) {
        return (namestr *)popFree((stack **)(&namefreelist));
    }
    setflag("ERROR in nmalloc: NULL namefreelist");
    return NULL;
}
Exemple #4
0
tdble GfFormCalcFunc( void *cmd, void *parmHandle, const char *path )
{
	tdble result;
	char error = FALSE;
	tPSCommand *command = (tPSCommand *)cmd;
	tPSStackItem *item = NULL;
	pushDouble( &item, 0.0f );
	item->varList = parmHandle;
	execCommands( &item, command, path );
	result = (tdble)popDouble( &item, &error );
	while( item != NULL && !error )
		popFree( &item );
	return result;
}
Exemple #5
0
void BufRead(int blkno, void* pData)
{
	Buf* pBuf;

	pBuf = BufFind(blkno);
	if( pBuf != NULL )
	{
		removeLru(blkno);
		insertLru(pBuf);
		copyBlock((char*)pBuf->pMem, (char*)pData);
		return;
	}

	pBuf = popFree();
	pBuf->blkno = blkno;
	//pBuf->pMem = (void*)malloc(BLOCK_SIZE);
	DevReadBlock(blkno, (char*)pBuf->pMem);
	insertHash(pBuf);
	insertClean(pBuf);
	removeLru(blkno);
	insertLru(pBuf);

	copyBlock((char*)pBuf->pMem, (char*)pData);
}