NeoMutt  2024-04-25-1-g3de005
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mhemail.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include "mutt/lib.h"
32#include "email/lib.h"
33#include "mhemail.h"
34
39struct MhEmail *mh_entry_new(void)
40{
41 return mutt_mem_calloc(1, sizeof(struct MhEmail));
42}
43
48void mh_entry_free(struct MhEmail **ptr)
49{
50 if (!ptr || !*ptr)
51 return;
52
53 struct MhEmail *md = *ptr;
54 FREE(&md->canon_fname);
55 email_free(&md->email);
56
57 FREE(ptr);
58}
59
64void mharray_clear(struct MhEmailArray *mha)
65{
66 if (!mha)
67 return;
68
69 struct MhEmail **mdp = NULL;
70 ARRAY_FOREACH(mdp, mha)
71 {
72 mh_entry_free(mdp);
73 }
74
75 ARRAY_FREE(mha);
76}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:204
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:46
Structs that make up an email.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:45
struct MhEmail * mh_entry_new(void)
Create a new Mh entry.
Definition: mhemail.c:39
void mh_entry_free(struct MhEmail **ptr)
Free a Mh object.
Definition: mhemail.c:48
void mharray_clear(struct MhEmailArray *mha)
Free a Mh array.
Definition: mhemail.c:64
Mh Email helper.
Convenience wrapper for the library headers.
A Mh Email helper.
Definition: mhemail.h:36
struct Email * email
Temporary Email.
Definition: mhemail.h:37
char * canon_fname
Canonical filename for hashing.
Definition: mhemail.h:38