NeoMutt
2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
pattern_data.c
Go to the documentation of this file.
1
29
#include "config.h"
30
#include <stddef.h>
31
#include "
pattern_data.h
"
32
37
struct
PatternData
*
pattern_data_new
(
void
)
38
{
39
struct
PatternData
*pd =
mutt_mem_calloc
(1,
sizeof
(
struct
PatternData
));
40
41
ARRAY_INIT
(&pd->
entries
);
42
43
return
pd;
44
}
45
49
void
pattern_data_free
(
struct
Menu
*
menu
,
void
**ptr)
50
{
51
if
(!ptr || !*ptr)
52
return
;
53
54
struct
PatternData
*pd = *ptr;
55
56
struct
PatternEntry
*pe = NULL;
57
ARRAY_FOREACH
(pe, &pd->
entries
)
58
{
59
FREE
(&pe->
tag
);
60
FREE
(&pe->
expr
);
61
FREE
(&pe->
desc
);
62
}
63
64
ARRAY_FREE
(&pd->
entries
);
65
FREE
(ptr);
66
}
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition:
array.h:212
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition:
array.h:204
ARRAY_INIT
#define ARRAY_INIT(head)
Initialize an array.
Definition:
array.h:65
pattern_data_free
void pattern_data_free(struct Menu *menu, void **ptr)
Free Pattern Data - Implements Menu::mdata_free() -.
Definition:
pattern_data.c:49
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition:
memory.c:76
FREE
#define FREE(x)
Definition:
memory.h:55
pattern_data_new
struct PatternData * pattern_data_new(void)
Create new Pattern Data.
Definition:
pattern_data.c:37
pattern_data.h
Private Pattern Data.
Menu
Definition:
lib.h:79
PatternData
Data to pass to the Pattern Functions.
Definition:
pattern_data.h:47
PatternData::menu
struct Menu * menu
Pattern Menu.
Definition:
pattern_data.h:51
PatternData::entries
struct PatternEntryArray entries
Patterns for the Menu.
Definition:
pattern_data.h:52
PatternEntry
A line in the Pattern Completion menu.
Definition:
pattern_data.h:35
PatternEntry::desc
const char * desc
Description of pattern.
Definition:
pattern_data.h:39
PatternEntry::tag
const char * tag
Copied to buffer if selected.
Definition:
pattern_data.h:37
PatternEntry::expr
const char * expr
Displayed in the menu.
Definition:
pattern_data.h:38