NeoMutt  2024-04-25-89-g194907
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)
 Free our hash table data - Implements hash_hdata_free_t -.
 
static void tags_deleter (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -.
 
static void idxfmt_hashelem_free (int type, void *obj, intptr_t data)
 Free our hash table data - Implements hash_hdata_free_t -.
 
static void thread_hash_destructor (int type, void *obj, intptr_t data)
 Free our hash table data - 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:39
+ 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

Free our hash table data - Implements hash_hdata_free_t -.

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

Definition at line 46 of file set.c.

47{
48 if (data == 0)
49 return; /* LCOV_EXCL_LINE */
50
51 struct ConfigSet *cs = (struct ConfigSet *) data;
52
53 const struct ConfigSetType *cst = NULL;
54
56 {
57 struct Inheritance *i = obj;
58
59 struct HashElem *he_base = cs_get_base(i->parent);
60 struct ConfigDef *cdef = he_base->data;
61
62 if (!cdef)
63 return; // LCOV_EXCL_LINE
64
65 cst = cs_get_type_def(cs, he_base->type);
66 if (cst && cst->destroy)
67 cst->destroy(cs, (void **) &i->var, cdef);
68
69 FREE(&i->name);
70 FREE(&i);
71 }
72 else
73 {
74 struct ConfigDef *cdef = obj;
75
76 cst = cs_get_type_def(cs, type);
77 if (cst && cst->destroy)
78 cst->destroy(cs, &cdef->var, cdef);
79
80 /* If we allocated the initial value, clean it up */
81 if (cdef->type & D_INTERNAL_INITIAL_SET)
82 FREE(&cdef->initial);
84 {
85 FREE(&cdef->name);
86 FREE(&cdef->docs);
87 FREE(&cdef);
88 }
89 }
90}
const struct ConfigSetType * cs_get_type_def(const struct ConfigSet *cs, unsigned int type)
Get the definition for a type.
Definition: set.c:198
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:160
#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:43
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:44
void * data
User-supplied data.
Definition: hash.h:46
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 D_INTERNAL_INHERITED
Config item is inherited.
Definition: types.h:89
#define D_INTERNAL_FREE_CONFIGDEF
Config item must have its ConfigDef freed.
Definition: types.h:87
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
Definition: types.h:90
+ 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

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 225 of file tags.c.

226{
227 FREE(&obj);
228}
+ Here is the caller graph for this function:

◆ idxfmt_hashelem_free()

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

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 409 of file hook.c.

410{
411 struct HookList *hl = obj;
412 struct Hook *h = NULL;
413 struct Hook *tmp = NULL;
414
415 TAILQ_FOREACH_SAFE(h, hl, entries, tmp)
416 {
417 TAILQ_REMOVE(hl, h, entries);
418 hook_free(&h);
419 }
420
421 FREE(&hl);
422}
static void hook_free(struct Hook **ptr)
Free a Hook.
Definition: hook.c:92
#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:68
+ 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

Free our hash table data - Implements hash_hdata_free_t -.

Definition at line 1021 of file mutt_thread.c.

1022{
1023 FREE(&obj);
1024}
+ 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: