Block data heap operations
[Global/general functions]

Data Structures

Typedefs

Functions


Detailed Description

MiniGUI maintains some private block data heaps to allocate data blocks which have fixed size, such as the clipping rectangles in a region. By using the private heap, we can avoiding calling malloc and free function frequently, so will have a slight performance enhancement.


Typedef Documentation

typedef struct _BLOCKHEAP BLOCKHEAP

MiniGUI's private block data heap.

See also:
InitBlockDataHeap, DestroyBlockDataHeap
typedef BLOCKHEAP * PBLOCKHEAP

Data type of the pointer to a BLOCKHEAP.

See also:
BLOCKHEAP

Definition at line 400 of file gdi.h.


Function Documentation

void * BlockDataAlloc ( PBLOCKHEAP  heap  ) 

Allocates a data block from private heap.

This function allocates a data block from an initialized block data heap. The allocated block will have the size of heap->bd_size. If there is no free block in the heap, this function will try to allocate the block from the system heap by using malloc(3) function.

Parameters:
heap The pointer to the initialized heap.
Returns:
Pointer to the allocated data block, NULL on error.
See also:
InitBlockDataHeap, BlockDataFree
void BlockDataFree ( PBLOCKHEAP  heap,
void *  data 
)

Frees an allocated data block.

This function frees the specified data block pointed to by data to the heap heap. If the block was allocated by using malloc function, this function will free the element by using free(3) function.

Parameters:
heap The pointer to the heap.
data The pointer to the element to be freed.
See also:
InitBlockDataHeap, BlockDataAlloc
void DestroyBlockDataHeap ( PBLOCKHEAP  heap  ) 

Destroys a private block data heap.

Parameters:
heap The pointer to the heap to be destroied.
See also:
InitBlockDataHeap, BLOCKHEAP
void InitBlockDataHeap ( PBLOCKHEAP  heap,
size_t  bd_size,
size_t  heap_size 
)

Initializes a private block data heap.

This function initializes a block data heap pointed to by heap. It will allocate the buffer used by the heap from system heap by using malloc(3). Initially, the heap has heap_size blocks free, and each is bd_size bytes long.

Parameters:
heap The pointer to the heap structure.
bd_size The size of one block in bytes.
heap_size The size of the heap in blocks.
Returns:
heap->heap will contains a valid pointer on success, NULL on error.
Note:
This function does not return anything. You should check the heap field of the heap structure.
See also:
BLOCKHEAP
Generated on Thu Apr 7 16:01:47 2011 for MiniGUI V3.0.12 API Reference by  doxygen 1.6.3