Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sobj_fl.c File Reference


Detailed Description

Freelist of instances of struct sobj.

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "sobject_p.h"

Include dependency graph for sobj_fl.c:

Include dependency graph

Data Structures

struct  sobj_fl_element
 A freelist element. More...
struct  sobj_fl_block
 A freelist block of simple object instances. More...

Defines

#define SOBJ_FL_BLOCKSIZE   (1024)
 The blocksize for the freelist.

Functions

void sobj_fl_alloc_block (void)
 Allocate a new block of sobj instances.
sobjsobj_fl_alloc (void)
 Allocate a sobj instance from the freelist.
void sobj_fl_dealloc (struct sobj *sobj)
 De-allocate a sobj instance.
void sobj_fl_cleanup (void)
 Final cleanup function for the freelists.

Variables

sobj_fl_blocksobj_fl_blocklist = 0
 The head of the freelist's block list.
sobj_fl_elementsobj_fl = 0
 The head of the sobj freelist.
int sobj_fl_count = 0
 The number of elements in the freelist.

Define Documentation

#define SOBJ_FL_BLOCKSIZE   (1024)
 

The blocksize for the freelist.


Function Documentation

struct sobj* sobj_fl_alloc void   ) 
 

Allocate a sobj instance from the freelist.

Returns:
The allocated (un-initialized) instance.

void sobj_fl_alloc_block void   )  [static]
 

Allocate a new block of sobj instances.

void sobj_fl_cleanup void   ) 
 

Final cleanup function for the freelists.

The function checks if all allocated objects have been put back to the freelist. If a freelist is incomplete, the freelist blocks are not de-allocated.

void sobj_fl_dealloc struct sobj sobj  ) 
 

De-allocate a sobj instance.

The instance is added to the freelist.

Parameters:
sobj The de-allocated instance.


Variable Documentation

struct sobj_fl_element* sobj_fl = 0 [static]
 

The head of the sobj freelist.

struct sobj_fl_block* sobj_fl_blocklist = 0 [static]
 

The head of the freelist's block list.

int sobj_fl_count = 0 [static]
 

The number of elements in the freelist.


Generated on Sat Jul 23 16:05:19 2005 for sobject by  doxygen 1.3.9.1