pgpmempool.h

来自「可以实现对邮件的加密解密以及签名」· C头文件 代码 · 共 69 行

H
69
字号
/*____________________________________________________________________________
        Copyright (C) 2002 PGP Corporation
        All rights reserved.

        $Id: pgpMemPool.h,v 1.7 2002/08/06 20:11:00 dallen Exp $
____________________________________________________________________________*/

#ifndef Included_pgpMemPool_h
#define Included_pgpMemPool_h


#include "pgpOpaqueStructs.h"
#include "pgpPubTypes.h"
#include "pgpMemoryMgr.h"
#include "pgpTypes.h"

PGP_BEGIN_C_DECLARATIONS


struct MemPool
{
	PGPContextRef	context;
	
	struct PoolBuf *head;
	char *freeptr;
	unsigned freespace;
	unsigned chunksize;	/* Default starting point */
	unsigned long totalsize;
	int (*purge)(void *);	/* Return non-zero to retry alloc */
	void *purgearg;
};



/*
 * Nice clean interfaces
 */
#define memPoolIsEmpty(pool) ((pool)->head == 0)

void 
memPoolInit(PGPContextRef context, MemPool *pool);

void 
memPoolSetPurge(MemPool *pool, int (*purge)(void *), void *arg);

void 
memPoolEmpty(MemPool *pool);

void 
memPoolCutBack(MemPool *dest, MemPool const *cutback);

void  *
memPoolAlloc(MemPool *pool, unsigned len, unsigned alignment);

PGPMemoryMgrRef
pgpMemPoolMemoryMgr( MemPool *pool );


#ifdef DEADCODE
char const  *
memPoolStore(MemPool *pool, char const *str);
#endif

#define memPoolNew(pool, type) memPoolAlloc(pool, sizeof(type), alignof(type))

PGP_END_C_DECLARATIONS

#endif /* Included_pgpMemPool_h */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?