Only seed database for Debian install if we're using default config
[onak.git] / mem.h
1 /*
2  * mem.h - Routines to cleanup memory after use.
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  */
8
9 #ifndef __MEM_H_
10 #define __MEM_H_
11
12 #include "keystructs.h"
13
14 /**
15  *      packet_dup - duplicate an OpenPGP packet.
16  *      @packet: The packet to duplicate.
17  *
18  *      This function takes an OpenPGP packet structure and duplicates it,
19  *      including the data part. It returns NULL if there is a problem
20  *      allocating memory for the duplicate.
21  */
22 struct openpgp_packet *packet_dup(struct openpgp_packet *packet);
23
24 /**
25  *      packet_list_add - Adds an OpenPGP packet list to another.
26  *      @list: The packet list to add to.
27  *      @list_end: The end of the packet list to add to.
28  *      @packet_list: The packet list to add.
29  *
30  *      This function takes an OpenPGP packet list and adds it to another list,
31  *      duplicating it in the process. The list to add to need not exists to
32  *      begin with, in which case the function simply duplicates the supplied
33  *      list.
34  */
35 void packet_list_add(struct openpgp_packet_list **list,
36                 struct openpgp_packet_list **list_end,
37                 struct openpgp_packet_list *packet_list);
38
39 /**
40  *      free_packet - free the memory used by an OpenPGP packet.
41  *      @packet: The packet to free.
42  *
43  *      Takes an OpenPGP packet structure and frees the memory used by it,
44  *      including the data part.
45  */
46 void free_packet(struct openpgp_packet *packet);
47
48 /**
49  *      free_packet_list - free the memory used by an OpenPGP packet list.
50  *      @packet_list: The packet list to free.
51  *
52  *      Takes an OpenPGP packet list structure and frees the memory used by the
53  *      packets in it and the linked list overhead.
54  */
55 void free_packet_list(struct openpgp_packet_list *packet_list);
56
57 /**
58  *      free_signedpacket_list - free an OpenPGP signed packet list.
59  *      @signedpacket_list: The packet list to free.
60  *
61  *      Takes an OpenPGP signed packet list structure and frees the memory used
62  *      by the packets and signatures it and the linked list overhead.
63  */
64 void free_signedpacket_list(
65                 struct openpgp_signedpacket_list *signedpacket_list);
66
67 /**
68  *      free_publickey - free an OpenPGP public key structure.
69  *      @key: The key to free.
70  *
71  *      Takes an OpenPGP key and frees the memory used by all the structures it
72  *      contains.
73  */
74 void free_publickey(struct openpgp_publickey *key);
75
76 /**
77  *      free_statskey - free an stats key structure.
78  *      @key: The key to free.
79  *
80  *      Takes a stats key and frees the memory used by it and the linked list
81  *      of sigs under it. Doesn't recurse into the list as it's assumed all the
82  *      objects referenced also exist in the hash.
83  */
84 void free_statskey(struct stats_key *key);
85
86 #endif /* __MEM_H_ */