/******************************************************************** * * memchain.h - Utility for associating allocated memory * * Copyright 1997-2002 TeraLogic, Inc. * All Rights Reserved * * memChainCreate: Creates a memChain object. * (O) instance: returns the memChain instance. * (I) memLimit: Optionally limits the memory allocated with a * memChain. Set to 0xFFFFFFFF for no limit. * * memChainDestroy: Destroys a memChain object. * (I) instance: The memChain instance. * * memChainAlloc: Allocates a memory block and associates it with * the specified memChain object. * (I) instance: The memChain instance. * (I) size: Size of memory (in bytes) requested. * * _Id: memchain.h,v 1.1 2002/06/10 17:20:08 tvogt Exp ********************************************************************/ #ifndef _memchain_h #define _memchain_h #include "dsthallocal.h" #ifdef __cplusplus extern "C" { #endif /* user-defined malloc/free */ typedef void* (*myMalloc_f) (unsigned int size, const char *strFunctionName, int nLine); typedef void (*myFree_f) (void *block, const char *strFunctionName, int nLine); /* memChain Setup Info */ typedef struct memChainSetup { DS_U32 memLimit; myMalloc_f Malloc; myFree_f Free; } memChainSetup_t, *memChainSetupPtr_t; typedef struct memChainHead* memId_t; /* API */ #define memChainCreate(a, b) _memChainCreate((a), (b), __func__, __LINE__) #define memChainDestroy(a) _memChainDestroy((a), __func__, __LINE__) #define memChainAlloc(a, b) _memChainAlloc((a), (b), __func__, __LINE__) DHL_RESULT _memChainCreate (memId_t *memId, memChainSetupPtr_t setupPtr, const char *func, int nLine); DHL_RESULT _memChainDestroy (memId_t memId, const char *func, int nLine); void* _memChainAlloc (memId_t memId, DS_U32 size, const char *func, int nLine); #ifdef __cplusplus } #endif #endif /* _memchain_h */ /******************************************************************** * _Log: memchain.h,v * Revision 1.1 2002/06/10 17:20:08 tvogt * First checkin of TL9xx Transport Driver * * * TL8xx Derived Revision 1.6.12.1 2002/01/12 11:09:12 neelakan ********************************************************************/