NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
adata.c
Go to the documentation of this file.
1
29#include "config.h"
30#include "private.h"
31#include "mutt/lib.h"
32#include "adata.h"
33
34struct Connection;
35
43void nntp_adata_free(void **ptr)
44{
45 if (!ptr || !*ptr)
46 return;
47
48 struct NntpAccountData *adata = *ptr;
49
50 mutt_file_fclose(&adata->fp_newsrc);
51 FREE(&adata->newsrc_file);
52 FREE(&adata->authenticators);
53 FREE(&adata->overview_fmt);
54 FREE(&adata->conn);
55 FREE(&adata->groups_list);
56 mutt_hash_free(&adata->groups_hash);
57 FREE(ptr);
58}
59
66{
67 struct NntpAccountData *adata = mutt_mem_calloc(1, sizeof(struct NntpAccountData));
68 adata->conn = conn;
69 adata->groups_hash = mutt_hash_new(1009, MUTT_HASH_NO_FLAGS);
71 adata->groups_max = 16;
72 adata->groups_list = mutt_mem_malloc(adata->groups_max * sizeof(struct NntpMboxData *));
73 return adata;
74}
#define mutt_file_fclose(FP)
Definition: file.h:138
void nntp_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition: adata.c:43
void nntp_hashelem_free(int type, void *obj, intptr_t data)
Free our hash table data - Implements hash_hdata_free_t -.
Definition: nntp.c:117
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
Definition: hash.c:259
void mutt_hash_set_destructor(struct HashTable *table, hash_hdata_free_t fn, intptr_t fn_data)
Set the destructor for a Hash Table.
Definition: hash.c:301
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:457
#define MUTT_HASH_NO_FLAGS
No flags are set.
Definition: hash.h:109
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:91
#define FREE(x)
Definition: memory.h:45
Convenience wrapper for the library headers.
struct NntpAccountData * nntp_adata_new(struct Connection *conn)
Allocate and initialise a new NntpAccountData structure.
Definition: adata.c:65
Pop-specific Account data.
GUI display the mailboxes in a side panel.
void * adata
Private data (for Mailbox backends)
Definition: account.h:42
NNTP-specific Account data -.
Definition: adata.h:36
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:62
NNTP-specific Mailbox data -.
Definition: mdata.h:34