NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
Hash Data Free API

Prototype for Hash Destructor callback function. More...

Functions

void group_hash_free (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -. More...
 
static void cs_hashelem_free (int type, void *obj, intptr_t data)
 Callback function for the Hash Table - Implements hash_hdata_free_t -. More...
 
static void tags_deleter (int type, void *obj, intptr_t data)
 Delete a tag - Implements hash_hdata_free_t -. More...
 
void thread_hash_destructor (int type, void *obj, intptr_t data)
 Hash Destructor callback - Implements hash_hdata_free_t -. More...
 
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 -. More...
 
void nntp_hashelem_free (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -. More...
 

Detailed Description

Prototype for Hash Destructor callback function.

Parameters
typeHash Type
objObject to free
dataData associated with the Hash

Contract

Function Documentation

◆ group_hash_free()

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

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 79 of file group.c.

80{
81 struct Group *g = obj;
82 group_free(&g);
83}
void group_free(struct Group **ptr)
Free an Address Group.
Definition: group.c:44
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 47 of file set.c.

48{
49 if (data == 0)
50 return; /* LCOV_EXCL_LINE */
51
52 struct ConfigSet *cs = (struct ConfigSet *) data;
53
54 const struct ConfigSetType *cst = NULL;
55
56 if (type & DT_INHERITED)
57 {
58 struct Inheritance *i = obj;
59
60 struct HashElem *he_base = cs_get_base(i->parent);
61 struct ConfigDef *cdef = he_base->data;
62
63 if (!cdef)
64 return; // LCOV_EXCL_LINE
65
66 cst = cs_get_type_def(cs, he_base->type);
67 if (cst && cst->destroy)
68 cst->destroy(cs, (void **) &i->var, cdef);
69
70 FREE(&i->name);
71 FREE(&i);
72 }
73 else
74 {
75 struct ConfigDef *cdef = obj;
76
77 cst = cs_get_type_def(cs, type);
78 if (cst && cst->destroy)
79 cst->destroy(cs, &cdef->var, cdef);
80
81 /* If we allocated the initial value, clean it up */
82 if (cdef->type & DT_INITIAL_SET)
83 FREE(&cdef->initial);
84 }
85}
#define FREE(x)
Definition: memory.h:43
const struct ConfigSetType * cs_get_type_def(const struct ConfigSet *cs, unsigned int type)
Get the definition for a type.
Definition: set.c:227
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:189
Definition: set.h:64
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
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:248
Container for lots of config items.
Definition: set.h:260
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
+ 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:

◆ thread_hash_destructor()

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

Hash Destructor callback - Implements hash_hdata_free_t -.

Definition at line 119 of file thread.c.

120{
121 FREE(&obj);
122}
+ 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 385 of file hook.c.

386{
387 struct HookList *hl = obj;
388 struct Hook *h = NULL;
389 struct Hook *tmp = NULL;
390
391 TAILQ_FOREACH_SAFE(h, hl, entries, tmp)
392 {
393 TAILQ_REMOVE(hl, h, entries);
394 delete_hook(h);
395 }
396
397 FREE(&hl);
398}
static void delete_hook(struct Hook *h)
Delete a Hook.
Definition: hook.c:347
#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:65
+ Here is the call graph for this function:
+ 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 116 of file nntp.c.

117{
118 nntp_mdata_free(&obj);
119}
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: