Skip to content

Commit

Permalink
rename cleanup functions
Browse files Browse the repository at this point in the history
Cleanup functions work by freeing global data.

- alias_shutdown()               -> alias_cleanup()
- alternates_free()              -> alternates_cleanup()
- attach_free()                  -> attach_cleanup()
- buf_pool_free()                -> buf_pool_cleanup()
- clear_source_stack()           -> source_stack_cleanup()
- colors_clear()                 -> colors_cleanup()
- color_notify_free()            -> color_notify_cleanup()
- commands_cleanup()             -> external_cleanup()
- commands_free()                -> commands_cleanup()
- config_cache_free()            -> config_cache_cleanup()
- crypto_module_free()           -> crypto_module_cleanup()
- merged_colors_clear()          -> merge_colors_cleanup()
- monitor_check_free()           -> monitor_check_cleanup()
- mutt_grouplist_free()          -> mutt_grouplist_cleanup()
- mutt_gsasl_done()              -> mutt_gsasl_cleanup()
- mutt_hist_free()               -> mutt_hist_cleanup()
- mutt_keys_free()               -> mutt_keys_cleanup()
- mutt_opts_free()               -> mutt_opts_cleanup()
- mutt_prex_free()               -> mutt_prex_cleanup()
- mutt_sasl_done()               -> mutt_sasl_cleanup()
- mutt_unlink_temp_attachments() -> mutt_temp_attachments_cleanup()
- quoted_colors_clear()          -> quoted_colors_cleanup()
- regex_colors_clear()           -> regex_colors_cleanup()
- rootwin_free()                 -> rootwin_cleanup()
- sb_shutdown()                  -> sb_cleanup()
- simple_colors_clear()          -> simple_colors_cleanup()
- subjrx_free()                  -> subjrx_cleanup()

and rename one non-cleanup function:

- mutt_mailbox_cleanup() -> mailbox_restore_timestamp()
  • Loading branch information
flatcap committed Jun 10, 2023
1 parent 0bfc700 commit faa4e9b
Show file tree
Hide file tree
Showing 70 changed files with 148 additions and 148 deletions.
4 changes: 2 additions & 2 deletions address/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ void mutt_grouplist_init(void)
}

/**
* mutt_grouplist_free - Free GroupList singleton resource
* mutt_grouplist_cleanup - Free GroupList singleton resource
*
* This is called once from init.c when deinitializing the global resources.
*/
void mutt_grouplist_free(void)
void mutt_grouplist_cleanup(void)
{
mutt_hash_free(&Groups);
}
Expand Down
2 changes: 1 addition & 1 deletion address/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ STAILQ_HEAD(GroupList, GroupNode);
void mutt_grouplist_add (struct GroupList *gl, struct Group *group);
void mutt_grouplist_add_addrlist (struct GroupList *gl, struct AddressList *a);
int mutt_grouplist_add_regex (struct GroupList *gl, const char *s, uint16_t flags, struct Buffer *err);
void mutt_grouplist_cleanup (void);
void mutt_grouplist_clear (struct GroupList *gl);
void mutt_grouplist_destroy (struct GroupList *gl);
void mutt_grouplist_free (void);
void mutt_grouplist_init (void);
int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *a);
int mutt_grouplist_remove_regex (struct GroupList *gl, const char *s);
Expand Down
4 changes: 2 additions & 2 deletions alias/alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ void alias_init(void)
}

/**
* alias_shutdown - Clean up the Alias globals
* alias_cleanup - Clean up the Alias globals
*/
void alias_shutdown(void)
void alias_cleanup(void)
{
struct Alias *np = NULL;
TAILQ_FOREACH(np, &Aliases, entries)
Expand Down
4 changes: 2 additions & 2 deletions alias/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ struct Buffer;
struct ConfigSubset;
struct Envelope;

void alias_init (void);
void alias_shutdown(void);
void alias_init (void);
void alias_cleanup(void);

void alias_create (struct AddressList *al, const struct ConfigSubset *sub);
struct AddressList *alias_lookup (const char *name);
Expand Down
4 changes: 2 additions & 2 deletions alternates.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static struct RegexList UnAlternates = STAILQ_HEAD_INITIALIZER(UnAlternates); //
static struct Notify *AlternatesNotify = NULL; ///< Notifications: #NotifyAlternates

/**
* alternates_free - Free the alternates lists
* alternates_cleanup - Free the alternates lists
*/
void alternates_free(void)
void alternates_cleanup(void)
{
notify_free(&AlternatesNotify);

Expand Down
2 changes: 1 addition & 1 deletion alternates.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ enum NotifyAlternates
};

void alternates_init(void);
void alternates_free(void);
void alternates_cleanup(void);

enum CommandResult parse_alternates (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
enum CommandResult parse_unalternates(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
Expand Down
4 changes: 2 additions & 2 deletions attach/attachments.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ static struct AttachMatch *attachmatch_new(void)
}

/**
* attach_free - Free the attachments lists
* attach_cleanup - Free the attachments lists
*/
void attach_free(void)
void attach_cleanup(void)
{
notify_free(&AttachmentsNotify);

Expand Down
2 changes: 1 addition & 1 deletion attach/attachments.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum NotifyAttach
};

void attach_init(void);
void attach_free(void);
void attach_cleanup(void);

void mutt_attachments_reset (struct MailboxView *mv);
int mutt_count_body_parts (const struct Mailbox *m, struct Email *e, FILE *fp);
Expand Down
4 changes: 2 additions & 2 deletions attach/mutt_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,9 @@ void mutt_add_temp_attachment(const char *filename)
}

/**
* mutt_unlink_temp_attachments - Delete all temporary attachments
* mutt_temp_attachments_cleanup - Delete all temporary attachments
*/
void mutt_unlink_temp_attachments(void)
void mutt_temp_attachments_cleanup(void)
{
struct ListNode *np = NULL;

Expand Down
2 changes: 1 addition & 1 deletion attach/mutt_attach.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, enum SaveAt

/* small helper functions to handle temporary attachment files */
void mutt_add_temp_attachment(const char *filename);
void mutt_unlink_temp_attachments(void);
void mutt_temp_attachments_cleanup(void);

#endif /* MUTT_ATTACH_MUTT_ATTACH_H */
16 changes: 8 additions & 8 deletions color/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,28 @@ const struct Mapping ColorNames[] = {
};

/**
* colors_clear - Reset all the simple, quoted and regex colours
* colors_cleanup - Reset all the simple, quoted and regex colours
*/
void colors_clear(void)
void colors_cleanup(void)
{
color_debug(LL_DEBUG5, "clean up\n");
mutt_debug(LL_NOTIFY, "NT_COLOR_RESET: [ALL]\n");
struct EventColor ev_c = { MT_COLOR_MAX, NULL };
notify_send(ColorsNotify, NT_COLOR, NT_COLOR_RESET, &ev_c);

simple_colors_clear();
quoted_colors_clear();
regex_colors_clear();
simple_colors_cleanup();
quoted_colors_cleanup();
regex_colors_cleanup();
}

/**
* mutt_colors_cleanup - Cleanup all the colours
*/
void mutt_colors_cleanup(void)
{
colors_clear();
merged_colors_clear();
color_notify_free();
colors_cleanup();
merged_colors_cleanup();
color_notify_cleanup();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion color/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ void mutt_colors_init(void);
void mutt_colors_cleanup(void);
bool mutt_color_has_pattern(enum ColorId cid);

void colors_clear(void);
void colors_cleanup(void);

#endif /* MUTT_COLOR_COLOR_H */
2 changes: 1 addition & 1 deletion color/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s,

if (mutt_str_equal(buf->data, "*"))
{
colors_clear();
colors_cleanup();
return MUTT_CMD_SUCCESS;
}

Expand Down
4 changes: 2 additions & 2 deletions color/merged.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ void merged_colors_init(void)
}

/**
* merged_colors_clear - Free the list of Merged colours
* merged_colors_cleanup - Free the list of Merged colours
*/
void merged_colors_clear(void)
void merged_colors_cleanup(void)
{
struct AttrColor *ac = NULL;
struct AttrColor *tmp = NULL;
Expand Down
2 changes: 1 addition & 1 deletion color/merged.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern struct AttrColorList MergedColors;

struct AttrColor * merged_color_overlay(struct AttrColor *base, struct AttrColor *over);

void merged_colors_clear(void);
void merged_colors_cleanup(void);
void merged_colors_init(void);

#endif /* MUTT_COLOR_MERGED_H */
4 changes: 2 additions & 2 deletions color/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void color_notify_init(void)
}

/**
* color_notify_free - Free the Colour notification
* color_notify_cleanup - Free the Colour notification
*/
void color_notify_free(void)
void color_notify_cleanup(void)
{
notify_free(&ColorsNotify);
}
Expand Down
2 changes: 1 addition & 1 deletion color/notify2.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct EventColor
};

void color_notify_init(void);
void color_notify_free(void);
void color_notify_cleanup(void);

void mutt_color_observer_add (observer_t callback, void *global_data);
void mutt_color_observer_remove(observer_t callback, void *global_data);
Expand Down
6 changes: 3 additions & 3 deletions color/quoted.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ static int find_highest_used(void)
}

/**
* quoted_colors_clear - Reset the quoted-email colours
* quoted_colors_cleanup - Reset the quoted-email colours
*/
void quoted_colors_clear(void)
void quoted_colors_cleanup(void)
{
color_debug(LL_DEBUG5, "QuotedColors: clean up\n");
for (size_t i = 0; i < COLOR_QUOTES_MAX; i++)
Expand Down Expand Up @@ -192,8 +192,8 @@ static void qstyle_free(struct QuoteStyle **ptr)
return;

struct QuoteStyle *qc = *ptr;

FREE(&qc->prefix);

FREE(ptr);
}

Expand Down
2 changes: 1 addition & 1 deletion color/quoted.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct QuoteStyle
struct QuoteStyle *up, *down; ///< Parent (less quoted) and child (more quoted) levels
};

void quoted_colors_clear(void);
void quoted_colors_cleanup(void);
struct AttrColor * quoted_colors_get(int q);
int quoted_colors_num_used(void);

Expand Down
4 changes: 2 additions & 2 deletions color/regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ void regex_colors_init(void)
}

/**
* regex_colors_clear - Clear the Regex colours
* regex_colors_cleanup - Clear the Regex colours
*/
void regex_colors_clear(void)
void regex_colors_cleanup(void)
{
color_debug(LL_DEBUG5, "clean up regex\n");
regex_color_list_clear(&AttachList);
Expand Down
2 changes: 1 addition & 1 deletion color/regex4.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void regex_color_clear(struct RegexColor *rcol);
void regex_color_free(struct RegexColorList *list, struct RegexColor **ptr);
struct RegexColor * regex_color_new (void);

void regex_colors_clear(void);
void regex_colors_cleanup(void);
struct RegexColorList *regex_colors_get_list(enum ColorId cid);
void regex_colors_init(void);

Expand Down
4 changes: 2 additions & 2 deletions color/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void simple_colors_init(void)
}

/**
* simple_colors_clear - Reset the simple colour definitions
* simple_colors_cleanup - Reset the simple colour definitions
*/
void simple_colors_clear(void)
void simple_colors_cleanup(void)
{
color_debug(LL_DEBUG5, "clean up defs\n");
for (size_t i = 0; i < MT_COLOR_MAX; i++)
Expand Down
2 changes: 1 addition & 1 deletion color/simple2.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool simple_color_is_set (enum ColorId cid);
void simple_color_reset (enum ColorId cid);
struct AttrColor *simple_color_set (enum ColorId cid, int fg, int bg, int attrs);

void simple_colors_clear(void);
void simple_colors_cleanup(void);
void simple_colors_init(void);

#endif /* MUTT_COLOR_SIMPLE2_H */
4 changes: 2 additions & 2 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,9 +1505,9 @@ static enum CommandResult parse_version(struct Buffer *buf, struct Buffer *s,
}

/**
* clear_source_stack - Free memory from the stack used for the source command
* source_stack_cleanup - Free memory from the stack used for the source command
*/
void clear_source_stack(void)
void source_stack_cleanup(void)
{
mutt_list_free(&MuttrcStack);
}
Expand Down
2 changes: 1 addition & 1 deletion commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer
char *mutt_get_sourced_cwd(void);

int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err);
void clear_source_stack(void);
void source_stack_cleanup(void);
int source_rc(const char *rcfile_path, struct Buffer *err);

enum CommandResult set_dump(ConfigDumpFlags flags, struct Buffer *err);
Expand Down
4 changes: 2 additions & 2 deletions config/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ const char *cc_charset(void)
}

/**
* config_cache_free - Cleanup the cache of charset config variables
* config_cache_cleanup - Cleanup the cache of charset config variables
*/
void config_cache_free(void)
void config_cache_cleanup(void)
{
if (NeoMutt)
notify_observer_remove(NeoMutt->notify, cc_config_observer, NULL);
Expand Down
2 changes: 1 addition & 1 deletion config/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
const struct Slist *cc_assumed_charset(void);
const char * cc_charset (void);

void config_cache_free(void);
void config_cache_cleanup(void);

#endif /* MUTT_CONFIG_CACHE_H */
4 changes: 2 additions & 2 deletions conn/gsasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ static bool mutt_gsasl_init(void)
}

/**
* mutt_gsasl_done - Shutdown GNU SASL library
* mutt_gsasl_cleanup - Shutdown GNU SASL library
*/
void mutt_gsasl_done(void)
void mutt_gsasl_cleanup(void)
{
if (!MuttGsaslCtx)
return;
Expand Down
2 changes: 1 addition & 1 deletion conn/gsasl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct Connection;

void mutt_gsasl_client_finish(Gsasl_session **sctx);
int mutt_gsasl_client_new (struct Connection *conn, const char *mech, Gsasl_session **sctx);
void mutt_gsasl_done (void);
void mutt_gsasl_cleanup (void);
const char *mutt_gsasl_get_mech (const char *requested_mech, const char *server_mechlist);

#endif /* MUTT_CONN_GSASL2_H */
4 changes: 2 additions & 2 deletions conn/sasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,12 @@ void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
}

/**
* mutt_sasl_done - Invoke when processing is complete
* mutt_sasl_cleanup - Invoke when processing is complete
*
* This is a cleanup function, used to free all memory used by the library.
* Invoke when processing is complete.
*/
void mutt_sasl_done(void)
void mutt_sasl_cleanup(void)
{
/* As we never use the server-side, the silently ignore the return value */
sasl_client_done();
Expand Down
2 changes: 1 addition & 1 deletion conn/sasl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct Connection;
bool sasl_auth_validator(const char *authenticator);

int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn);
void mutt_sasl_done (void);
void mutt_sasl_cleanup (void);
int mutt_sasl_interact (sasl_interact_t *interaction);
void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn);

Expand Down
4 changes: 2 additions & 2 deletions core/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ void commands_register(const struct Command *cmds, const size_t num_cmds)
}

/**
* commands_free - Free Commands array
* commands_cleanup - Free Commands array
*/
void commands_free(void)
void commands_cleanup(void)
{
ARRAY_FREE(&Commands);
}
Expand Down
2 changes: 1 addition & 1 deletion core/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct Command
struct Command *command_get (const char *s);

size_t commands_array (struct Command **first);
void commands_free (void);
void commands_cleanup (void);
void commands_init (void);
void commands_register (const struct Command *cmds, const size_t num_cmds);

Expand Down
Loading

0 comments on commit faa4e9b

Please sign in to comment.