From 794ed8d3cfb03ef7e701775192dcd772ce7c07f1 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 4 Sep 2018 18:20:48 +0100 Subject: [PATCH] drop unnec casts --- browser.c | 2 +- compose.c | 10 +++++----- config/address.c | 2 +- config/mbtable.c | 2 +- config/regex.c | 2 +- conn/sasl.c | 12 ++++++------ conn/ssl.c | 2 +- conn/tunnel.c | 8 ++++---- imap/command.c | 4 ++-- imap/imap.c | 4 ++-- maildir/mh.c | 4 ++-- ncrypt/crypt_gpgme.c | 2 +- ncrypt/pgpkey.c | 2 +- ncrypt/smime.c | 2 +- nntp/nntp.c | 2 +- notmuch/mutt_notmuch.c | 2 +- pop/pop.c | 18 +++++++++--------- pop/pop_lib.c | 10 +++++----- postpone.c | 2 +- query.c | 2 +- recvattach.c | 6 +++--- remailer.c | 2 +- 22 files changed, 51 insertions(+), 51 deletions(-) diff --git a/browser.c b/browser.c index 9006c7202..4685a712f 100644 --- a/browser.c +++ b/browser.c @@ -754,7 +754,7 @@ static void add_folder(struct Menu *m, struct BrowserState *state, #endif #ifdef USE_NNTP if (OptNews) - (state->entry)[state->entrylen].nd = (struct NntpData *) data; + (state->entry)[state->entrylen].nd = data; #endif (state->entrylen)++; } diff --git a/compose.c b/compose.c index 89afa58b0..10a085f05 100644 --- a/compose.c +++ b/compose.c @@ -256,7 +256,7 @@ static void init_header_padding(void) */ static void snd_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct AttachCtx *actx = (struct AttachCtx *) menu->data; + struct AttachCtx *actx = menu->data; mutt_expando_format(buf, buflen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), attach_format_str, (unsigned long) (actx->idx[actx->v2r[num]]), @@ -607,7 +607,7 @@ static void mutt_gen_compose_attach_list(struct AttachCtx *actx, struct Body *m, } else { - new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr)); + new = mutt_mem_calloc(1, sizeof(struct AttachPtr)); mutt_actx_add_attach(actx, new); new->content = m; m->aptr = new; @@ -1373,7 +1373,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, for (i = 0; i < numfiles; i++) { char *att = files[i]; - new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr)); + new = mutt_mem_calloc(1, sizeof(struct AttachPtr)); new->unowned = 1; new->content = mutt_make_file_attach(att); if (new->content) @@ -1493,7 +1493,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, if (!message_is_tagged(Context, i)) continue; - new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr)); + new = mutt_mem_calloc(1, sizeof(struct AttachPtr)); new->content = mutt_make_message_attach(Context, Context->hdrs[i], true); if (new->content) update_idx(menu, actx, new); @@ -1790,7 +1790,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, mutt_error(_("Unknown Content-Type %s"), type); continue; } - new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr)); + new = mutt_mem_calloc(1, sizeof(struct AttachPtr)); /* Touch the file */ fp = mutt_file_fopen(fname, "w"); if (!fp) diff --git a/config/address.c b/config/address.c index 2477fff84..46efba733 100644 --- a/config/address.c +++ b/config/address.c @@ -46,7 +46,7 @@ static void address_destroy(const struct ConfigSet *cs, void *var, const struct if (!cs || !var || !cdef) return; /* LCOV_EXCL_LINE */ - struct Address **a = (struct Address **) var; + struct Address **a = var; if (!*a) return; diff --git a/config/mbtable.c b/config/mbtable.c index c1cafdf8b..d6f248fb4 100644 --- a/config/mbtable.c +++ b/config/mbtable.c @@ -95,7 +95,7 @@ static void mbtable_destroy(const struct ConfigSet *cs, void *var, const struct if (!cs || !var || !cdef) return; /* LCOV_EXCL_LINE */ - struct MbTable **m = (struct MbTable **) var; + struct MbTable **m = var; if (!*m) return; diff --git a/config/regex.c b/config/regex.c index 6e8915a3a..18df26b88 100644 --- a/config/regex.c +++ b/config/regex.c @@ -49,7 +49,7 @@ static void regex_destroy(const struct ConfigSet *cs, void *var, const struct Co if (!cs || !var || !cdef) return; /* LCOV_EXCL_LINE */ - struct Regex **r = (struct Regex **) var; + struct Regex **r = var; if (!*r) return; diff --git a/conn/sasl.c b/conn/sasl.c index bf70531ff..e66ea3f03 100644 --- a/conn/sasl.c +++ b/conn/sasl.c @@ -217,7 +217,7 @@ static int mutt_sasl_start(void) */ static int mutt_sasl_cb_authname(void *context, int id, const char **result, unsigned int *len) { - struct Account *account = (struct Account *) context; + struct Account *account = context; if (!result) return SASL_FAIL; @@ -261,7 +261,7 @@ static int mutt_sasl_cb_authname(void *context, int id, const char **result, uns */ static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret) { - struct Account *account = (struct Account *) context; + struct Account *account = context; int len; if (!account || !psecret) @@ -331,7 +331,7 @@ static sasl_callback_t *mutt_sasl_get_callbacks(struct Account *account) */ static int mutt_sasl_conn_open(struct Connection *conn) { - struct SaslData *sasldata = (struct SaslData *) conn->sockdata; + struct SaslData *sasldata = conn->sockdata; conn->sockdata = sasldata->sockdata; int rc = (sasldata->msasl_open)(conn); conn->sockdata = sasldata; @@ -350,7 +350,7 @@ static int mutt_sasl_conn_open(struct Connection *conn) */ static int mutt_sasl_conn_close(struct Connection *conn) { - struct SaslData *sasldata = (struct SaslData *) conn->sockdata; + struct SaslData *sasldata = conn->sockdata; /* restore connection's underlying methods */ conn->sockdata = sasldata->sockdata; @@ -383,7 +383,7 @@ static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen int rc; unsigned int olen; - struct SaslData *sasldata = (struct SaslData *) conn->sockdata; + struct SaslData *sasldata = conn->sockdata; /* if we still have data in our read buffer, copy it into buf */ if (sasldata->blen > sasldata->bpos) @@ -453,7 +453,7 @@ static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t const char *pbuf = NULL; unsigned int olen, plen; - struct SaslData *sasldata = (struct SaslData *) conn->sockdata; + struct SaslData *sasldata = conn->sockdata; conn->sockdata = sasldata->sockdata; /* encode data, if necessary */ diff --git a/conn/ssl.c b/conn/ssl.c index 5ae4a5996..a7211c3c9 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -345,7 +345,7 @@ static void ssl_dprint_err_stack(void) */ static int ssl_passwd_cb(char *buf, int buflen, int rwflag, void *userdata) { - struct Account *account = (struct Account *) userdata; + struct Account *account = userdata; if (mutt_account_getuser(account) < 0) return 0; diff --git a/conn/tunnel.c b/conn/tunnel.c index 11d7128ab..82f4bcbbd 100644 --- a/conn/tunnel.c +++ b/conn/tunnel.c @@ -142,7 +142,7 @@ static int tunnel_socket_open(struct Connection *conn) */ static int tunnel_socket_close(struct Connection *conn) { - struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata; + struct TunnelData *tunnel = conn->sockdata; int status; close(tunnel->readfd); @@ -168,7 +168,7 @@ static int tunnel_socket_close(struct Connection *conn) */ static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len) { - struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata; + struct TunnelData *tunnel = conn->sockdata; int rc; rc = read(tunnel->readfd, buf, len); @@ -190,7 +190,7 @@ static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len) */ static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t len) { - struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata; + struct TunnelData *tunnel = conn->sockdata; int rc; rc = write(tunnel->writefd, buf, len); @@ -212,7 +212,7 @@ static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t */ static int tunnel_socket_poll(struct Connection *conn, time_t wait_secs) { - struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata; + struct TunnelData *tunnel = conn->sockdata; int ofd; int rc; diff --git a/imap/command.c b/imap/command.c index 1544eae02..02d116afb 100644 --- a/imap/command.c +++ b/imap/command.c @@ -552,7 +552,7 @@ static void cmd_parse_list(struct ImapData *idata, char *s) unsigned int litlen; if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST) - list = (struct ImapList *) idata->cmddata; + list = idata->cmddata; else list = &lb; @@ -752,7 +752,7 @@ static void cmd_parse_search(struct ImapData *idata, const char *s) { if (mutt_str_atoui(s, &uid) < 0) continue; - h = (struct Header *) mutt_hash_int_find(idata->uid_hash, uid); + h = mutt_hash_int_find(idata->uid_hash, uid); if (h) h->matched = true; } diff --git a/imap/imap.c b/imap/imap.c index 3a7c600c7..d77f93d3b 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -268,7 +268,7 @@ static int make_msg_set(struct ImapData *idata, struct Buffer *buf, int flag, */ static bool compare_flags_for_copy(struct Header *h) { - struct ImapHeaderData *hd = (struct ImapHeaderData *) h->data; + struct ImapHeaderData *hd = h->data; if (h->read != hd->read) return true; @@ -2593,7 +2593,7 @@ static int imap_tags_edit(struct Context *ctx, const char *tags, char *buf, size { char *new = NULL; char *checker = NULL; - struct ImapData *idata = (struct ImapData *) ctx->data; + struct ImapData *idata = ctx->data; /* Check for \* flags capability */ if (!imap_has_flag(&idata->flags, NULL)) diff --git a/maildir/mh.c b/maildir/mh.c index d5ab2e549..f0a5fa973 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -119,7 +119,7 @@ struct MhData */ static inline struct MhData *mh_data(struct Context *ctx) { - return (struct MhData *) ctx->data; + return ctx->data; } /** @@ -1365,7 +1365,7 @@ static void maildir_delayed_parsing(struct Context *ctx, struct Maildir **md, keylen = maildir_hcache_keylen(key); } void *data = mutt_hcache_fetch(hc, key, keylen); - struct timeval *when = (struct timeval *) data; + struct timeval *when = data; if (data && !ret && lastchanged.st_mtime <= when->tv_sec) { diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index a623d5b4c..e2abd802b 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -3158,7 +3158,7 @@ static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int co */ static void crypt_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct CryptKeyInfo **key_table = (struct CryptKeyInfo **) menu->data; + struct CryptKeyInfo **key_table = menu->data; struct CryptEntry entry; entry.key = key_table[num]; diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 9b7ef1974..b950d145d 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -334,7 +334,7 @@ static const char *pgp_entry_fmt(char *buf, size_t buflen, size_t col, int cols, */ static void pgp_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct PgpUid **KeyTable = (struct PgpUid **) menu->data; + struct PgpUid **KeyTable = menu->data; struct PgpEntry entry; entry.uid = KeyTable[num]; diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 91c7b766c..2265ba024 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -443,7 +443,7 @@ static char *smime_key_flags(int flags) */ static void smime_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct SmimeKey **Table = (struct SmimeKey **) menu->data; + struct SmimeKey **Table = menu->data; struct SmimeKey *this = Table[num]; char *truststate = NULL; switch (this->trust) diff --git a/nntp/nntp.c b/nntp/nntp.c index 8fca93987..b2922d003 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -2371,7 +2371,7 @@ int nntp_check_new_groups(struct NntpServer *nserv) if (Context && Context->mailbox->magic == MUTT_NNTP) { buf[0] = '\0'; - if (nntp_query((struct NntpData *) Context->data, buf, sizeof(buf)) < 0) + if (nntp_query(Context->data, buf, sizeof(buf)) < 0) return -1; } } diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 61b232cc0..76188647f 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -1200,7 +1200,7 @@ static void append_message(struct Context *ctx, notmuch_query_t *q, if (newpath) { /* remember that file has been moved -- nm_mbox_sync() will update the DB */ - struct NmHdrData *hd = (struct NmHdrData *) h->data; + struct NmHdrData *hd = h->data; if (hd) { diff --git a/pop/pop.c b/pop/pop.c index d3fbb005b..2216df738 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -202,8 +202,8 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h) static int fetch_uidl(char *line, void *data) { int i, index; - struct Context *ctx = (struct Context *) data; - struct PopData *pop_data = (struct PopData *) ctx->data; + struct Context *ctx = data; + struct PopData *pop_data = ctx->data; char *endp = NULL; errno = 0; @@ -247,10 +247,10 @@ static int fetch_uidl(char *line, void *data) */ static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data) { - struct Context *ctx = (struct Context *) data; + struct Context *ctx = data; if (!ctx) return -1; - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; if (!pop_data) return -1; @@ -313,7 +313,7 @@ static header_cache_t *pop_hcache_open(struct PopData *pop_data, const char *pat */ static int pop_fetch_headers(struct Context *ctx) { - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; struct Progress progress; #ifdef USE_HCACHE @@ -574,7 +574,7 @@ static void pop_clear_cache(struct PopData *pop_data) */ static int pop_mbox_close(struct Context *ctx) { - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; if (!pop_data) return 0; @@ -611,7 +611,7 @@ static int pop_msg_open(struct Context *ctx, struct Message *msg, int msgno) char buf[LONG_STRING]; char path[PATH_MAX]; struct Progress progressbar; - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; struct PopCache *cache = NULL; struct Header *h = ctx->hdrs[msgno]; unsigned short bcache = 1; @@ -771,7 +771,7 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint) { int i, j, ret = 0; char buf[LONG_STRING]; - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; struct Progress progress; #ifdef USE_HCACHE header_cache_t *hc = NULL; @@ -854,7 +854,7 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint) static int pop_mbox_check(struct Context *ctx, int *index_hint) { int ret; - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; if ((pop_data->check_time + PopCheckinterval) > time(NULL)) return 0; diff --git a/pop/pop_lib.c b/pop/pop_lib.c index cd48067c2..c355d2b0b 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -130,7 +130,7 @@ static void pop_error(struct PopData *pop_data, char *msg) */ static int fetch_capa(char *line, void *data) { - struct PopData *pop_data = (struct PopData *) data; + struct PopData *pop_data = data; char *c = NULL; if (mutt_str_strncasecmp(line, "SASL", 4) == 0) @@ -163,7 +163,7 @@ static int fetch_capa(char *line, void *data) */ static int fetch_auth(char *line, void *data) { - struct PopData *pop_data = (struct PopData *) data; + struct PopData *pop_data = data; if (!pop_data->auth_list) { @@ -421,7 +421,7 @@ err_conn: */ void pop_logout(struct Context *ctx) { - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; if (pop_data->status == POP_CONNECTED) { @@ -576,7 +576,7 @@ int pop_fetch_data(struct PopData *pop_data, const char *query, static int check_uidl(char *line, void *data) { unsigned int index; - struct Context *ctx = (struct Context *) data; + struct Context *ctx = data; char *endp = NULL; errno = 0; @@ -607,7 +607,7 @@ static int check_uidl(char *line, void *data) */ int pop_reconnect(struct Context *ctx) { - struct PopData *pop_data = (struct PopData *) ctx->data; + struct PopData *pop_data = ctx->data; if (pop_data->status == POP_CONNECTED) return 0; diff --git a/postpone.c b/postpone.c index 7fa3ec306..364331a86 100644 --- a/postpone.c +++ b/postpone.c @@ -195,7 +195,7 @@ void mutt_update_num_postponed(void) */ static void post_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct Context *ctx = (struct Context *) menu->data; + struct Context *ctx = menu->data; mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx, ctx->hdrs[num], MUTT_FORMAT_ARROWCURSOR); diff --git a/query.c b/query.c index 5c2e8045e..e42e0d2ee 100644 --- a/query.c +++ b/query.c @@ -209,7 +209,7 @@ static struct Query *run_query(char *s, int quiet) */ static int query_search(struct Menu *m, regex_t *re, int n) { - struct Entry *table = (struct Entry *) m->data; + struct Entry *table = m->data; if (table[n].data->name && !regexec(re, table[n].data->name, 0, NULL, 0)) return 0; diff --git a/recvattach.c b/recvattach.c index e1fcc9cad..f0767f0a0 100644 --- a/recvattach.c +++ b/recvattach.c @@ -424,7 +424,7 @@ const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, */ static void attach_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct AttachCtx *actx = (struct AttachCtx *) menu->data; + struct AttachCtx *actx = menu->data; mutt_expando_format(buf, buflen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), attach_format_str, (unsigned long) (actx->idx[actx->v2r[num]]), @@ -440,7 +440,7 @@ static void attach_entry(char *buf, size_t buflen, struct Menu *menu, int num) */ int mutt_tag_attach(struct Menu *menu, int n, int m) { - struct AttachCtx *actx = (struct AttachCtx *) menu->data; + struct AttachCtx *actx = menu->data; struct Body *cur = actx->idx[actx->v2r[n]]->content; bool ot = cur->tagged; @@ -1202,7 +1202,7 @@ static void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Header } else { - new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr)); + new = mutt_mem_calloc(1, sizeof(struct AttachPtr)); mutt_actx_add_attach(actx, new); new->content = m; diff --git a/remailer.c b/remailer.c index 611f33b96..c56c03c8e 100644 --- a/remailer.c +++ b/remailer.c @@ -493,7 +493,7 @@ static const char *mix_format_str(char *buf, size_t buflen, size_t col, int cols */ static void mix_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct Remailer **type2_list = (struct Remailer **) menu->data; + struct Remailer **type2_list = menu->data; mutt_expando_format(buf, buflen, 0, MuttIndexWindow->cols, NONULL(MixEntryFormat), mix_format_str, (unsigned long) type2_list[num], MUTT_FORMAT_ARROWCURSOR); -- 2.40.0