⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgppktlist.c

📁 vc环境下的pgp源码
💻 C
字号:
/*
 * $Id: pgpPktList.c,v 1.11 1997/12/12 01:14:42 heller Exp $
 */

#include "pgpConfig.h"

#include <string.h>	/* For memcpy */
#include <stddef.h>	/* For offsetof */

#include "pgpPktList.h"
#include "pgpContext.h"
#include "pgpMem.h"

PktList *
pgpPktListNew(
	PGPContextRef	context,
	int type, PGPByte const *buf, size_t len)
{
	PktList *pkl;

	pkl = (PktList *)pgpContextMemAlloc( context,
		len + offsetof(PktList, buf), kPGPMemoryMgrFlags_Clear);
	if (pkl) {
		pkl->context	= context;
		pkl->next = (PktList *)0;
		pkl->type = type;
		pkl->len = len;
		memcpy(pkl->buf, buf, len);
	}
	return pkl;
}

void
pgpPktListFreeOne(PktList *pkl)
{
	PGPContextRef	cdkContext;

	pgpAssertAddrValid( pkl, PktList );
	cdkContext	= pkl->context;
	
	pgpClearMemory( pkl,  pkl->len + offsetof(PktList, buf));
	pgpContextMemFree( cdkContext, pkl);
}

void
pgpPktListFreeList(PktList *list)
{
	PktList				*cur;
	PGPContextRef		cdkContext;

	if( IsNull(list) )
		return;
	cdkContext = list->context;
	while (list) {
		/* If you don't understand this, yer a wimp.  Belch.  Grunt. */
		list = (cur = list)->next;
		pgpClearMemory( cur,  cur->len + offsetof(PktList, buf));
		pgpContextMemFree( cdkContext, cur);
	}
}

⌨️ 快捷键说明

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