NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
mdemail.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 "mdemail.h"
34
40{
41 return mutt_mem_calloc(1, sizeof(struct MdEmail));
42}
43
48void maildir_entry_free(struct MdEmail **ptr)
49{
50 if (!ptr || !*ptr)
51 return;
52
53 struct MdEmail *md = *ptr;
54 FREE(&md->canon_fname);
55 email_free(&md->email);
56
57 FREE(ptr);
58}
59
64void maildirarray_clear(struct MdEmailArray *mda)
65{
66 if (!mda)
67 return;
68
69 struct MdEmail **mdp = NULL;
70 ARRAY_FOREACH(mdp, mda)
71 {
73 }
74
75 ARRAY_FREE(mda);
76}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:203
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:44
Structs that make up an email.
void maildir_entry_free(struct MdEmail **ptr)
Free a Maildir object.
Definition: mdemail.c:48
struct MdEmail * maildir_entry_new(void)
Create a new Maildir entry.
Definition: mdemail.c:39
void maildirarray_clear(struct MdEmailArray *mda)
Free a Maildir array.
Definition: mdemail.c:64
Maildir Email helper.
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:43
Convenience wrapper for the library headers.
A Maildir Email helper.
Definition: mdemail.h:34
char * canon_fname
Definition: mdemail.h:36
struct Email * email
Definition: mdemail.h:35