NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Hash Data Free API

Prototype for Hash Destructor callback function. More...

Functions

static void group_hash_free (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -.
 
static void cs_hashelem_free (int type, void *obj, intptr_t data)
 Callback function for the Hash Table - Implements hash_hdata_free_t -.
 
static void tags_deleter (int type, void *obj, intptr_t data)
 Delete a tag - Implements hash_hdata_free_t -.
 
static void idxfmt_hashelem_free (int type, void *obj, intptr_t data)
 Delete an index-format-hook from the Hash Table - Implements hash_hdata_free_t -.
 
static void thread_hash_destructor (int type, void *obj, intptr_t data)
 Hash Destructor callback - Implements hash_hdata_free_t -.
 
void nntp_hashelem_free (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -.
 

Detailed Description

Prototype for Hash Destructor callback function.

Parameters
typeHash Type
objObject to free
dataData associated with the Hash
Precondition
obj is not NULL

Function Documentation

◆ group_hash_free()

static void group_hash_free ( int  type,
void *  obj,
intptr_t  data 
)
static

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 84 of file group.c.

85{
86 struct Group *g = obj;
87 group_free(&g);
88}
static void group_free(struct Group **ptr)
Free an Address Group.
Definition: group.c:49
A set of email addresses.
Definition: group.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cs_hashelem_free()

static void cs_hashelem_free ( int  type,
void *  obj,
intptr_t  data 
)
static

Callback function for the Hash Table - Implements hash_hdata_free_t -.

Parameters
typeObject type, e.g. DT_STRING
objObject to destroy
dataConfigSet associated with the object

Definition at line 43 of file set.c.

44{
45 if (data == 0)
46 return; /* LCOV_EXCL_LINE */
47
48 struct ConfigSet *cs = (struct ConfigSet *) data;
49
50 const struct ConfigSetType *cst = NULL;
51
52 if (type & DT_INHERITED)
53 {
54 struct Inheritance *i = obj;
55
56 struct HashElem *he_base = cs_get_base(i->parent);
57 struct ConfigDef *cdef = he_base->data;
58
59 if (!cdef)
60 return; // LCOV_EXCL_LINE
61
62 cst = cs_get_type_def(cs, he_base->type);
63 if (cst && cst->destroy)
64 cst->destroy(cs, (void **) &i->var, cdef);
65
66 FREE(&i->name);
67 FREE(&i);
68 }
69 else
70 {
71 struct ConfigDef *cdef = obj;
72
73 cst = cs_get_type_def(cs, type);
74 if (cst && cst->destroy)
75 cst->destroy(cs, &cdef->var, cdef);
76
77 /* If we allocated the initial value, clean it up */
78 if (cdef->type & DT_INITIAL_SET)
79 FREE(&cdef->initial);
80 if (cdef->type & DT_FREE_CONFIGDEF)
81 {
82 FREE(&cdef->name);
83 FREE(&cdef->docs);
84 FREE(&cdef);
85 }
86 }
87}
const struct ConfigSetType * cs_get_type_def(const struct ConfigSet *cs, unsigned int type)
Get the definition for a type.
Definition: set.c:195
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:157
#define FREE(x)
Definition: memory.h:45
Definition: set.h:64
const char * name
User-visible name.
Definition: set.h:65
intptr_t var
Storage for the variable.
Definition: set.h:85
intptr_t initial
Initial value.
Definition: set.h:67
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
const char * docs
One-liner description.
Definition: set.h:84
int type
Data type, e.g. DT_STRING.
Definition: set.h:97
void(* destroy)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
Definition: set.h:240
Container for lots of config items.
Definition: set.h:252
The item stored in a Hash Table.
Definition: hash.h:44
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
void * data
User-supplied data.
Definition: hash.h:47
An inherited config item.
Definition: inheritance.h:32
struct HashElem * parent
HashElem of parent config item.
Definition: inheritance.h:33
const char * name
Name of this config item.
Definition: inheritance.h:34
intptr_t var
(Pointer to) value, of config item
Definition: inheritance.h:35
#define DT_INITIAL_SET
Config item must have its initial value freed.
Definition: types.h:79
#define DT_INHERITED
Config item is inherited.
Definition: types.h:78
#define DT_FREE_CONFIGDEF
Config item must have its ConfigDef freed.
Definition: types.h:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tags_deleter()

static void tags_deleter ( int  type,
void *  obj,
intptr_t  data 
)
static

Delete a tag - Implements hash_hdata_free_t -.

Definition at line 210 of file tags.c.

211{
212 FREE(&obj);
213}
+ Here is the caller graph for this function:

◆ idxfmt_hashelem_free()

static void idxfmt_hashelem_free ( int  type,
void *  obj,
intptr_t  data 
)
static

Delete an index-format-hook from the Hash Table - Implements hash_hdata_free_t -.

Definition at line 384 of file hook.c.

385{
386 struct HookList *hl = obj;
387 struct Hook *h = NULL;
388 struct Hook *tmp = NULL;
389
390 TAILQ_FOREACH_SAFE(h, hl, entries, tmp)
391 {
392 TAILQ_REMOVE(hl, h, entries);
393 delete_hook(h);
394 }
395
396 FREE(&hl);
397}
static void delete_hook(struct Hook *h)
Delete a Hook.
Definition: hook.c:346
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:735
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
A list of user hooks.
Definition: hook.c:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ thread_hash_destructor()

static void thread_hash_destructor ( int  type,
void *  obj,
intptr_t  data 
)
static

Hash Destructor callback - Implements hash_hdata_free_t -.

Definition at line 1018 of file mutt_thread.c.

1019{
1020 FREE(&obj);
1021}
+ Here is the caller graph for this function:

◆ nntp_hashelem_free()

void nntp_hashelem_free ( int  type,
void *  obj,
intptr_t  data 
)

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 117 of file nntp.c.

118{
119 nntp_mdata_free(&obj);
120}
void nntp_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free()
Definition: mdata.c:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function: