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

📄 pgppktlist.c

📁 著名的加密软件的应用于电子邮件中
💻 C
字号:
/*
* pgpPktList.c
*
* Copyright (C) 1996,1997 Pretty Good Privacy, Inc. All rights reserved.
*
* $Id: pgpPktList.c,v 1.1.2.1 1997/06/07 09:51:28 mhw Exp $
*/

#if HAVE_CONFIG_H
#include "config.h"
#endif

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

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

struct PktList *
pgpPktListNew(int type, byte const *buf, size_t len)
{
		struct PktList *pkl;

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

void
pgpPktListFreeOne(struct PktList *pkl)
{
		memset(pkl, 0, pkl->len + offsetof(struct PktList, buf));
		pgpMemFree(pkl);
}

void
pgpPktListFreeList(struct PktList *list)
{
		struct PktList *cur;

		while (list) {
			/* If you don't understand this, yer a wimp. Belch. Grunt. */
			list = (cur = list)->next;
			memset(cur, 0, cur->len + offsetof(struct PktList, buf));
			pgpMemFree(cur);
		}
}

⌨️ 快捷键说明

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