From 816fa9773775ed00a665abe3c67344b60c15528d Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 11 Apr 2019 03:06:02 +0100 Subject: [PATCH] refactor: light tidying - clang-format - remove unused declaration - use bools in config definitions - fix doxygen comments - remove unnecessary check - tidy list/queue definitions --- account.h | 1 - alias.h | 1 - browser.c | 2 +- conn/socket.h | 5 ----- editmsg.c | 3 ++- email/email.h | 1 - email/group.h | 4 ---- email/parameter.h | 6 +----- email/url.h | 1 - handler.c | 6 ++++-- init.h | 6 +++--- mailbox.h | 1 - mutt/buffer.c | 2 +- mutt/list.h | 7 ------- mutt/logging.h | 7 ------- mutt/regex3.h | 1 - muttlib.c | 2 +- ncrypt/crypt_gpgme.c | 9 +++------ ncrypt/pgpkey.c | 2 +- pattern.h | 3 +-- sidebar.h | 1 - 21 files changed, 18 insertions(+), 53 deletions(-) diff --git a/account.h b/account.h index d8e1b370c..36facbc5a 100644 --- a/account.h +++ b/account.h @@ -41,7 +41,6 @@ struct Account void *adata; void (*free_adata)(void **); }; - TAILQ_HEAD(AccountList, Account); extern struct AccountList AllAccounts; ///< List of all Accounts diff --git a/alias.h b/alias.h index 1214ffde9..478c47711 100644 --- a/alias.h +++ b/alias.h @@ -42,7 +42,6 @@ struct Alias short num; TAILQ_ENTRY(Alias) entries; }; - TAILQ_HEAD(AliasList, Alias); void mutt_alias_create(struct Envelope *cur, struct Address *iaddr); diff --git a/browser.c b/browser.c index 1e162a74a..21c160792 100644 --- a/browser.c +++ b/browser.c @@ -1105,7 +1105,7 @@ void mutt_browser_select_dir(const char *f) } /** - * mutt_select_file - Let the user select a file + * mutt_buffer_select_file - Let the user select a file * @param[in] file Buffer for the result * @param[in] flags Flags, see #SelectFileFlags * @param[out] files Array of selected files diff --git a/conn/socket.h b/conn/socket.h index 8594c7c89..e74cdd9c9 100644 --- a/conn/socket.h +++ b/conn/socket.h @@ -40,11 +40,6 @@ enum ConnectionType struct Connection; -/** - * struct ConnectionList - A list of connections - */ -TAILQ_HEAD(ConnectionList, Connection); - struct Connection *mutt_socket_new(enum ConnectionType type); int mutt_socket_open(struct Connection *conn); diff --git a/editmsg.c b/editmsg.c index 835d16234..b6679971c 100644 --- a/editmsg.c +++ b/editmsg.c @@ -83,7 +83,8 @@ static int ev_message(enum EvMessage action, struct Mailbox *m, struct Email *e) } const CopyHeaderFlags chflags = - CH_NOLEN | (((m->magic == MUTT_MBOX) || (m->magic == MUTT_MMDF)) ? CH_NO_FLAGS : CH_NOSTATUS); + CH_NOLEN | + (((m->magic == MUTT_MBOX) || (m->magic == MUTT_MMDF)) ? CH_NO_FLAGS : CH_NOSTATUS); rc = mutt_append_message(ctx_tmp->mailbox, m, e, MUTT_CM_NO_FLAGS, chflags); int oerrno = errno; diff --git a/email/email.h b/email/email.h index 0d1711c59..38420a708 100644 --- a/email/email.h +++ b/email/email.h @@ -123,7 +123,6 @@ struct EmailNode struct Email *email; STAILQ_ENTRY(EmailNode) entries; }; - STAILQ_HEAD(EmailList, EmailNode); bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2); diff --git a/email/group.h b/email/group.h index 6325396c5..6eb39945a 100644 --- a/email/group.h +++ b/email/group.h @@ -50,10 +50,6 @@ struct GroupNode struct Group *group; STAILQ_ENTRY(GroupNode) entries; }; - -/** - * struct GroupList - A list of GroupNodes - */ STAILQ_HEAD(GroupList, GroupNode); void mutt_grouplist_init(void); diff --git a/email/parameter.h b/email/parameter.h index f1b67ee7c..8c0d8087f 100644 --- a/email/parameter.h +++ b/email/parameter.h @@ -26,11 +26,6 @@ #include #include "mutt/mutt.h" -/** - * struct ParameterList - List of parameters - */ -TAILQ_HEAD(ParameterList, Parameter); - /** * struct Parameter - Attribute associated with a MIME part */ @@ -40,6 +35,7 @@ struct Parameter char *value; TAILQ_ENTRY(Parameter) entries; }; +TAILQ_HEAD(ParameterList, Parameter); bool mutt_param_cmp_strict(const struct ParameterList *p1, const struct ParameterList *p2); void mutt_param_delete(struct ParameterList *p, const char *attribute); diff --git a/email/url.h b/email/url.h index 9d8b4de9d..74f1db108 100644 --- a/email/url.h +++ b/email/url.h @@ -58,7 +58,6 @@ struct UrlQueryString char *value; STAILQ_ENTRY(UrlQueryString) entries; }; - STAILQ_HEAD(UrlQueryStringHead, UrlQueryString); /** diff --git a/handler.c b/handler.c index 7b0f5c210..50564ee6e 100644 --- a/handler.c +++ b/handler.c @@ -874,7 +874,8 @@ static int external_body_handler(struct Body *b, struct State *s) state_attach_puts(strbuf, s); mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset, - (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY, NULL); + (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY, + NULL); } } else @@ -891,7 +892,8 @@ static int external_body_handler(struct Body *b, struct State *s) state_attach_puts(strbuf, s); mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset, - (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY, NULL); + (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY, + NULL); } } diff --git a/init.h b/init.h index b9424dd2b..1c0f93bef 100644 --- a/init.h +++ b/init.h @@ -1552,7 +1552,7 @@ struct ConfigDef MuttVars[] = { ** of mailboxes it polls for new mail just as if you had issued individual ** "$mailboxes" commands. */ - { "imap_condstore", DT_BOOL, R_NONE, &C_ImapCondStore, 0 }, + { "imap_condstore", DT_BOOL, R_NONE, &C_ImapCondStore, false }, /* ** .pp ** When \fIset\fP, mutt will use the CONDSTORE extension (RFC 7162) @@ -1674,7 +1674,7 @@ struct ConfigDef MuttVars[] = { ** for new mail, before timing out and closing the connection. Set ** to 0 to disable timing out. */ - { "imap_qresync", DT_BOOL, R_NONE, &C_ImapQResync, 0 }, + { "imap_qresync", DT_BOOL, R_NONE, &C_ImapQResync, false }, /* ** .pp ** When \fIset\fP, mutt will use the QRESYNC extension (RFC 7162) @@ -2503,7 +2503,7 @@ struct ConfigDef MuttVars[] = { ** subprocess failed. ** (PGP only) */ - { "pgp_check_gpg_decrypt_status_fd", DT_BOOL, R_NONE, &C_PgpCheckGpgDecryptStatusFd, 1 }, + { "pgp_check_gpg_decrypt_status_fd", DT_BOOL, R_NONE, &C_PgpCheckGpgDecryptStatusFd, true }, /* ** .pp ** If \fIset\fP, mutt will check the status file descriptor output diff --git a/mailbox.h b/mailbox.h index e2a544364..2fde142f3 100644 --- a/mailbox.h +++ b/mailbox.h @@ -149,7 +149,6 @@ struct MailboxNode struct Mailbox *mailbox; STAILQ_ENTRY(MailboxNode) entries; }; - STAILQ_HEAD(MailboxList, MailboxNode); extern struct MailboxList AllMailboxes; ///< List of all Mailboxes diff --git a/mutt/buffer.c b/mutt/buffer.c index cdc3a56ea..a1b0cc5b6 100644 --- a/mutt/buffer.c +++ b/mutt/buffer.c @@ -320,7 +320,7 @@ void mutt_buffer_strcpy(struct Buffer *buf, const char *s) } /** - * mutt_buffer_strcpy - Copy a string into a Buffer + * mutt_buffer_strcpy_n - Copy a string into a Buffer * @param buf Buffer to overwrite * @param s String to copy * @param len Length of string to copy diff --git a/mutt/list.h b/mutt/list.h index 06a2b4003..d5ee8df7b 100644 --- a/mutt/list.h +++ b/mutt/list.h @@ -35,13 +35,6 @@ struct ListNode char *data; STAILQ_ENTRY(ListNode) entries; }; - -/** - * struct ListHead - A generic list of strings - * - * The List is stored as a STAILQ. - * This means that insertions are quick at the head and tail of the list. - */ STAILQ_HEAD(ListHead, ListNode); /** diff --git a/mutt/logging.h b/mutt/logging.h index ac219be30..ce84368fc 100644 --- a/mutt/logging.h +++ b/mutt/logging.h @@ -75,13 +75,6 @@ struct LogLine char *message; STAILQ_ENTRY(LogLine) entries; }; - -/** - * struct LogList - A list of log lines - * - * The Log is stored as a STAILQ. - * This means that insertions are quick at the head and tail of the list. - */ STAILQ_HEAD(LogList, LogLine); #define mutt_debug(LEVEL, ...) MuttLogger(0, __FILE__, __LINE__, __func__, LEVEL, __VA_ARGS__) diff --git a/mutt/regex3.h b/mutt/regex3.h index 2aeb137a1..545ae81a5 100644 --- a/mutt/regex3.h +++ b/mutt/regex3.h @@ -69,7 +69,6 @@ struct RegexListNode struct Regex *regex; /**< Regex containing a regular expression */ STAILQ_ENTRY(RegexListNode) entries; /**< Next item in list */ }; - STAILQ_HEAD(RegexList, RegexListNode); /** diff --git a/muttlib.c b/muttlib.c index b687d1f87..9d3fa2b7f 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1714,7 +1714,7 @@ int mutt_inbox_cmp(const char *a, const char *b) } /** - * mutt_buffer_concat - Join a directory name and a filename + * mutt_buffer_concat_path - Join a directory name and a filename * @param d Buffer to add to * @param dir Directory name * @param fname File name diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 03ca9c603..c210e2ebb 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -985,7 +985,7 @@ static char *data_object_to_tempfile(gpgme_data_t data, FILE **fp_ret) #if GPGME_VERSION_NUMBER >= 0x010b00 /* gpgme >= 1.11.0 */ /** - * create_recipient_string - XXX + * create_recipient_string - Create a string of recipients * @param keylist Keys, space-separated * @param recpstring Buffer to store the recipients * @param use_smime Use SMIME @@ -3087,10 +3087,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) } gpgme_data_release(armored_data); - if (fp_out) - { - mutt_file_fclose(&fp_out); - } + mutt_file_fclose(&fp_out); } else { @@ -3317,7 +3314,7 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s) * | \%p | Protocol * | \%t | Trust/validity of the key-uid association * | \%u | User id - * | \%[...] | Date of key using strftime(3) + * | \%[fmt] | Date of key using strftime(3) * | | * | \%a | Algorithm * | \%c | Capabilities diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 45d108ec4..897db4fdf 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -160,7 +160,7 @@ struct PgpEntry * | \%n | Number * | \%t | Trust/validity of the key-uid association * | \%u | User id - * | \%[...] | Date of key using strftime(3) + * | \%[fmt] | Date of key using strftime(3) * | | * | \%a | Algorithm * | \%c | Capabilities diff --git a/pattern.h b/pattern.h index 48bb40ab2..e3c8f5308 100644 --- a/pattern.h +++ b/pattern.h @@ -39,8 +39,6 @@ extern bool C_ThoroughSearch; /* flag to mutt_pattern_comp() */ #define MUTT_FULL_MSG (1 << 0) /* enable body and header matching */ -SLIST_HEAD(PatternHead, Pattern); - /** * struct Pattern - A simple (non-regex) pattern */ @@ -65,6 +63,7 @@ struct Pattern struct ListHead multi_cases; } p; }; +SLIST_HEAD(PatternHead, Pattern); /** * enum PatternExecFlag - Flags for mutt_pattern_exec() diff --git a/sidebar.h b/sidebar.h index 5db8e0bf0..70de63843 100644 --- a/sidebar.h +++ b/sidebar.h @@ -28,7 +28,6 @@ #include struct Mailbox; -struct Context; /* These Config Variables are only used in sidebar.c */ extern short C_SidebarComponentDepth; -- 2.40.0