Woolz Image Processing  Version 1.7.5
AlcBlockStack

Files

file  AlcBlockStack.c
 A general purpose memory block allocator. Blocks are allocated and stored in on a stack.
 

Data Structures

struct  _AlcBlockStack
 General purpose data structure for maintaining blocks of some data type. Useful for efficient memory allocation. It's not a stack but a doubly linked list of blocks of data which can be used as a stack, heap, list, .... Typedef: AlcBlockStack. More...
 

Enumerations

enum  _AlcDirection {
  ALC_DIRECTION_FWD,
  ALC_DIRECTION_REV
}
 Data structure traversal direction. Typedef: AlcDirection. More...
 

Functions

AlcBlockStackAlcBlockStackNew (size_t nElem, size_t elmSz, AlcBlockStack *tBlk, AlcErrno *dstErr)
 Creates a new memory block with the required number of elements and adds it to the stack of existing blocks. More...
 
AlcErrno AlcBlockStackFree (AlcBlockStack *blk)
 Free's the given block and it's elements together with all those below it in the stack. It's not an error for a block's elements pointer to be NULL. More...
 

Detailed Description

Enumeration Type Documentation

Data structure traversal direction. Typedef: AlcDirection.

Enumerator
ALC_DIRECTION_FWD 

Towards end of a data structure, eg the tail of a list

ALC_DIRECTION_REV 

Towards begining of a data structure, eg the head of a list

Function Documentation

AlcBlockStack* AlcBlockStackNew ( size_t  nElem,
size_t  elmSz,
AlcBlockStack tBlk,
AlcErrno dstErr 
)

Creates a new memory block with the required number of elements and adds it to the stack of existing blocks.

Returns
New block stack, or NULL on error.
Parameters
nElemNumber of elements in block.
elmSzSize of elements.
tBlkTop block, may be NULL.
dstErrDestination pointer for error code, may be NULL.

References ALC_ER_ALLOC, ALC_ER_NONE, AlcCalloc(), AlcFree(), _AlcBlockStack::elements, _AlcBlockStack::elmCnt, _AlcBlockStack::maxElm, _AlcBlockStack::next, and _AlcBlockStack::prev.

Referenced by AlcCPQItemUnlink(), AlcKDTTreeFacts(), AlcLRUCacheFacts(), WlzCMeshExpValues(), and WlzCMeshNewNod3D().

AlcErrno AlcBlockStackFree ( AlcBlockStack blk)

Free's the given block and it's elements together with all those below it in the stack. It's not an error for a block's elements pointer to be NULL.

Returns
Error code.
Parameters
blkGiven top block.

References ALC_ER_NONE, ALC_ER_NULLPTR, AlcFree(), _AlcBlockStack::elements, and _AlcBlockStack::next.

Referenced by AlcCPQQueueFree(), AlcKDTTreeFree(), AlcLRUCacheFree(), WlzCMeshExpValues(), WlzCMeshFree2D(), WlzCMeshFree2D5(), and WlzCMeshFree3D().