diff --git a/src/libCom/freeList.3 b/src/libCom/freeList.3 new file mode 100644 index 000000000..72a0b18c7 --- /dev/null +++ b/src/libCom/freeList.3 @@ -0,0 +1,38 @@ +.TH freeList 1 "" "General Purpose Free List Library" +.ad b +.SH VERSION $Id$ +.SH NAME +freeList.c - General Purpose memory free list library +.SH SYNOPSIS +.nf + +freeListInitPvt - Initialize a free list +freeListCalloc - Allocate and initialize to zero a new element +freeListMalloc - Allocate a new element +freeListFree - Free an element,i.e. put on free list + + +void freeListInitPvt(void **ppvt,int size,int nmalloc); +void *freeListCalloc(void *pvt); +void *freeListMalloc(void *pvt); +void freeListFree(void *pvt,void*pmem); + +where : + +pvt - For private use by library. Caller must provide a "void *pvt" +size - Size in butes of each element. Note that all elements must be same size +nmalloc - Number of elements top allocate when regular malloc must be called. + +.fi +.SH DESCRIPTION +This library can be used to allocate and free fixed size memory elements. +Free elements are maintained on a free list rather then being returned to +the heap via calls to free. When it is necessary to call malloc, memory can +be allocated in multiples of the element size. +.SH RETURNS +.nf +freeListCalloc and freeListMalloc return address of element allocated +or NULL if no more memory could be obtained via call to malloc +.SH INCLUDES +freeLib.h +.fi diff --git a/src/libCom/gpHash.3 b/src/libCom/gpHash.3 new file mode 100644 index 000000000..85e7be84f --- /dev/null +++ b/src/libCom/gpHash.3 @@ -0,0 +1,54 @@ +.TH gpHash 1 "" "General Purpose Character String Hash Library" +.ad b +.SH VERSION $Id$ +.SH NAME +gpHash.c - General Purpose Hash Library +.SH SYNOPSIS +.nf + +gphInitPvt - Initialize +gphFind - Find an element taht has been hashed +gphAdd - Add a new entry +gphDelete - Delete an entry +gphFreeMem - Free all memory allocated by gpHash +gphDump - Dump current members + + +typedef struct{ + ELLNODE node; + char *name; /*address of name placed in directory*/ + void *pvtid; /*private name for subsystem user*/ + void *userPvt; /*private for user*/ +} GPHENTRY; + +void gphInitPvt(void **ppvt); +GPHENTRY *gphFind(void *pvt,char *name,void *pvtid); +GPHENTRY *gphAdd(void *pvt,char *name,void *pvtid); +void gphDelete(void *pvt,char *name,void *pvtid); +void gphFreeMem(void *pvt); +void gphDump(void *pvt); + + +where : + +pvt - For private use by library. Caller must provide a "void *pvt" +name - The character string that will be hashed and added to table +pvtid - The name plus value of this pointer constitute unique entry + +.fi +.SH DESCRIPTION +This library provides a general purpose directory of names that is accessed +via a hash table. The hash table contains 256 entries. Each entry is a list +of members that hash to the same value. The user can maintain seperate directories +via the same table by having a different pvtid for each directory. +.SH RETURNS +.nf +gphFind returns the address of the GPHENTRY describing the entry or NULL if name was not found. +gphAdd returns the address of the new GPHENTRY describing the entry or NULL if name was already +present. +.SH INCLUDES +gpHash.h +.SH REFERENCE +Fast Hashing of Variable Length Text Strings, Peter K. Pearson, +Communications of the ACM, June 1990 +.fi