From: Richard Russon Date: Wed, 12 Jul 2017 14:40:21 +0000 (+0100) Subject: rename some structs/enums/unions/constants X-Git-Tag: neomutt-20170714~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=383785b7e84c810d8598020d8c958ec0d7365709;p=neomutt rename some structs/enums/unions/constants struct/enum/union Capability_Aliases CapabilityAliases Capability_Alias CapabilityAlias CryptKeyinfo CryptKeyInfo div_type DivType DnArrayS DnArray FgetConvS FgetConv format_flag FormatFlag group_state_t GroupState hash_key HashKey hcache_ops_t HcacheOps history_class_t HistoryClass imap_auth_res_t ImapAuthRes IMAP_COMMAND_TYPE ImapCommandType key_cap_t KeyCap mdb_txn_mode MdbTxnMode NmCtxdata NmCtxData NmHdrdata NmHdrData NmHdrtag NmHdrTag packet_tags PacketTags pattern_exec_flag PatternExecFlag pgp_ring_t PgpRing pop_auth_res_t PopAuthRes sb_src SidebarSrc Sysexits SysExits url_scheme UrlScheme url_scheme_t UrlScheme validate Validate XDGType XdgType Constants kXDGConfigDirs XDG_CONFIG_DIRS kXDGConfigHome XDG_CONFIG_HOME ADDR GS_ADDR NONE GS_NONE RX GS_RX txn_read TXN_READ txn_uninitialized TXN_UNINITIALIZED txn_write TXN_WRITE Variables firstMessage first_message hideQuoted hide_quoted lastCached last_cached lastLine last_line lastLoaded last_loaded lastMessage last_message lineInfo line_info maxLine max_line newMailCount new_mail_count QuoteList quote_list SearchBack search_back SearchCompiled search_compiled searchDir search_dir SearchFlag search_flag SearchRE search_re WrapMargin wrap_margin --- diff --git a/addrbook.c b/addrbook.c index a0b40b4f6..712a1e23d 100644 --- a/addrbook.c +++ b/addrbook.c @@ -46,7 +46,7 @@ static const struct Mapping AliasHelp[] = { static const char *alias_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char tmp[SHORT_STRING], adr[SHORT_STRING]; struct Alias *alias = (struct Alias *) data; diff --git a/browser.c b/browser.c index dfeb117ef..47d903885 100644 --- a/browser.c +++ b/browser.c @@ -256,7 +256,7 @@ static int link_is_dir(const char *folder, const char *path) static const char *folder_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fn[SHORT_STRING], tmp[SHORT_STRING], permission[11]; char date[SHORT_STRING], *t_fmt = NULL; @@ -479,7 +479,7 @@ static const char *folder_format_str(char *dest, size_t destlen, size_t col, int static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fn[SHORT_STRING], tmp[SHORT_STRING]; struct Folder *folder = (struct Folder *) data; @@ -542,12 +542,12 @@ static const char *newsgroup_format_str(char *dest, size_t destlen, size_t col, snprintf(dest, destlen, tmp, Context->new); } else if (option(OPTMARKOLD) && - folder->ff->nd->lastCached >= folder->ff->nd->firstMessage && - folder->ff->nd->lastCached <= folder->ff->nd->lastMessage) + folder->ff->nd->last_cached >= folder->ff->nd->first_message && + folder->ff->nd->last_cached <= folder->ff->nd->last_message) { snprintf(tmp, sizeof(tmp), "%%%sd", fmt); snprintf(dest, destlen, tmp, - folder->ff->nd->lastMessage - folder->ff->nd->lastCached); + folder->ff->nd->last_message - folder->ff->nd->last_cached); } else { diff --git a/charset.c b/charset.c index f49075f70..69683bcb6 100644 --- a/charset.c +++ b/charset.c @@ -473,7 +473,7 @@ int mutt_convert_string(char **ps, const char *from, const char *to, int flags) * Used in sendlib.c for converting from mutt's Charset */ -struct FgetConvS +struct FgetConv { FILE *file; iconv_t cd; @@ -498,7 +498,7 @@ struct FgetConvNot */ FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags) { - struct FgetConvS *fc = NULL; + struct FgetConv *fc = NULL; iconv_t cd = (iconv_t) -1; static ICONV_CONST char *repls[] = { "\357\277\275", "?", 0 }; @@ -507,7 +507,7 @@ FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags) if (cd != (iconv_t) -1) { - fc = safe_malloc(sizeof(struct FgetConvS)); + fc = safe_malloc(sizeof(struct FgetConv)); fc->p = fc->ob = fc->bufo; fc->ib = fc->bufi; fc->ibl = 0; @@ -543,7 +543,7 @@ char *fgetconvs(char *buf, size_t l, FGETCONV *_fc) int fgetconv(FGETCONV *_fc) { - struct FgetConvS *fc = (struct FgetConvS *) _fc; + struct FgetConv *fc = (struct FgetConv *) _fc; if (!fc) return EOF; @@ -596,7 +596,7 @@ int fgetconv(FGETCONV *_fc) void fgetconv_close(FGETCONV **_fc) { - struct FgetConvS *fc = (struct FgetConvS *) *_fc; + struct FgetConv *fc = (struct FgetConv *) *_fc; if (fc->cd != (iconv_t) -1) iconv_close(fc->cd); diff --git a/compose.c b/compose.c index c4129a963..0ff44521d 100644 --- a/compose.c +++ b/compose.c @@ -632,7 +632,7 @@ static unsigned long cum_attachs_size(struct Menu *menu) static const char *compose_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[SHORT_STRING], tmp[SHORT_STRING]; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/compress.c b/compress.c index e444888b4..afad69623 100644 --- a/compress.c +++ b/compress.c @@ -356,7 +356,7 @@ static char *escape_path(char *src) static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { if (!dest || (data == 0)) return src; diff --git a/curs_lib.c b/curs_lib.c index 73f443c8c..b39808e84 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -668,7 +668,7 @@ void mutt_reflow_windows(void) #endif mutt_set_current_menu_redraw_full(); - /* the pager menu needs this flag set to recalc lineInfo */ + /* the pager menu needs this flag set to recalc line_info */ mutt_set_current_menu_redraw(REDRAW_FLOW); } diff --git a/curs_main.c b/curs_main.c index e916c03e4..b9b6f725c 100644 --- a/curs_main.c +++ b/curs_main.c @@ -590,7 +590,7 @@ void index_make_entry(char *s, size_t l, struct Menu *menu, int num) if (!h) return; - format_flag flag = MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX; + enum FormatFlag flag = MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX; int edgemsgno, reverse = Sort & SORT_REVERSE; struct MuttThread *tmp = NULL; diff --git a/enter.c b/enter.c index ccbd1d233..03887686a 100644 --- a/enter.c +++ b/enter.c @@ -256,7 +256,7 @@ int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multipl size_t i; wchar_t *tempbuf = NULL; size_t templen = 0; - history_class_t hclass; + enum HistoryClass hclass; wchar_t wc; mbstate_t mbstate; diff --git a/format_flags.h b/format_flags.h index c7e4bd076..74c6d6dcd 100644 --- a/format_flags.h +++ b/format_flags.h @@ -21,7 +21,8 @@ #include /* flags for mutt_FormatString() */ -typedef enum { +enum FormatFlag +{ MUTT_FORMAT_FORCESUBJ = (1 << 0), /* print the subject even if unchanged */ MUTT_FORMAT_TREE = (1 << 1), /* draw the thread tree */ MUTT_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */ @@ -30,12 +31,12 @@ typedef enum { MUTT_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */ MUTT_FORMAT_INDEX = (1 << 6), /* this is a main index entry */ MUTT_FORMAT_NOFILTER = (1 << 7) /* do not allow filtering on this pass */ -} format_flag; +}; typedef const char *format_t(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags); + unsigned long data, enum FormatFlag flags); void mutt_FormatString(char *dest, /* output buffer */ size_t destlen, /* output buffer len */ @@ -44,6 +45,6 @@ void mutt_FormatString(char *dest, /* output buffer */ const char *src, /* template string */ format_t *callback, /* callback for processing */ unsigned long data, /* callback data */ - format_flag flags); /* callback flags */ + enum FormatFlag flags); /* callback flags */ #endif /* _MUTT_FORMAT_FLAGS_H */ diff --git a/handler.c b/handler.c index 90ab82a4d..21bbc791c 100644 --- a/handler.c +++ b/handler.c @@ -524,7 +524,7 @@ struct EnrichedState size_t param_used; size_t param_len; int tag_level[RICH_LAST_TAG]; - int WrapMargin; + int wrap_margin; struct State *s; }; @@ -567,7 +567,7 @@ static void enriched_wrap(struct EnrichedState *stte) } } - extra = stte->WrapMargin - stte->line_len - stte->indent_len - + extra = stte->wrap_margin - stte->line_len - stte->indent_len - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize); if (extra > 0) { @@ -640,7 +640,7 @@ static void enriched_flush(struct EnrichedState *stte, int wrap) { if (!stte->tag_level[RICH_NOFILL] && (stte->line_len + stte->word_len > - (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - stte->indent_len))) + (stte->wrap_margin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - stte->indent_len))) enriched_wrap(stte); if (stte->buff_used) @@ -847,11 +847,11 @@ static int text_enriched_handler(struct Body *a, struct State *s) memset(&stte, 0, sizeof(stte)); stte.s = s; - stte.WrapMargin = + stte.wrap_margin = ((s->flags & MUTT_DISPLAY) ? (MuttIndexWindow->cols - 4) : ((MuttIndexWindow->cols - 4) < 72) ? (MuttIndexWindow->cols - 4) : 72); - stte.line_max = stte.WrapMargin * 4; + stte.line_max = stte.wrap_margin * 4; stte.line = safe_calloc(1, (stte.line_max + 1) * sizeof(wchar_t)); stte.param = safe_calloc(1, (STRING) * sizeof(wchar_t)); diff --git a/hash.c b/hash.c index 3b54e167a..0b53fbab3 100644 --- a/hash.c +++ b/hash.c @@ -23,7 +23,7 @@ #define SOMEPRIME 149711 -static unsigned int gen_string_hash(union hash_key key, unsigned int n) +static unsigned int gen_string_hash(union HashKey key, unsigned int n) { unsigned int h = 0; unsigned char *s = (unsigned char *) key.strkey; @@ -35,12 +35,12 @@ static unsigned int gen_string_hash(union hash_key key, unsigned int n) return h; } -static int cmp_string_key(union hash_key a, union hash_key b) +static int cmp_string_key(union HashKey a, union HashKey b) { return mutt_strcmp(a.strkey, b.strkey); } -static unsigned int gen_case_string_hash(union hash_key key, unsigned int n) +static unsigned int gen_case_string_hash(union HashKey key, unsigned int n) { unsigned int h = 0; unsigned char *s = (unsigned char *) key.strkey; @@ -52,17 +52,17 @@ static unsigned int gen_case_string_hash(union hash_key key, unsigned int n) return h; } -static int cmp_case_string_key(union hash_key a, union hash_key b) +static int cmp_case_string_key(union HashKey a, union HashKey b) { return mutt_strcasecmp(a.strkey, b.strkey); } -static unsigned int gen_int_hash(union hash_key key, unsigned int n) +static unsigned int gen_int_hash(union HashKey key, unsigned int n) { return key.intkey % n; } -static int cmp_int_key(union hash_key a, union hash_key b) +static int cmp_int_key(union HashKey a, union HashKey b) { if (a.intkey == b.intkey) return 0; @@ -139,7 +139,7 @@ struct Hash *hash_resize(struct Hash *ptr, int nelem, int lower) * data data to associate with `key' * allow_dup if nonzero, duplicate keys are allowed in the table */ -static int union_hash_insert(struct Hash *table, union hash_key key, void *data) +static int union_hash_insert(struct Hash *table, union HashKey key, void *data) { struct HashElem *ptr = NULL; unsigned int h; @@ -183,19 +183,19 @@ static int union_hash_insert(struct Hash *table, union hash_key key, void *data) int hash_insert(struct Hash *table, const char *strkey, void *data) { - union hash_key key; + union HashKey key; key.strkey = table->strdup_keys ? safe_strdup(strkey) : strkey; return union_hash_insert(table, key, data); } int int_hash_insert(struct Hash *table, unsigned int intkey, void *data) { - union hash_key key; + union HashKey key; key.intkey = intkey; return union_hash_insert(table, key, data); } -static struct HashElem *union_hash_find_elem(const struct Hash *table, union hash_key key) +static struct HashElem *union_hash_find_elem(const struct Hash *table, union HashKey key) { int hash; struct HashElem *ptr = NULL; @@ -213,7 +213,7 @@ static struct HashElem *union_hash_find_elem(const struct Hash *table, union has return NULL; } -static void *union_hash_find(const struct Hash *table, union hash_key key) +static void *union_hash_find(const struct Hash *table, union HashKey key) { struct HashElem *ptr = union_hash_find_elem(table, key); if (ptr) @@ -224,28 +224,28 @@ static void *union_hash_find(const struct Hash *table, union hash_key key) void *hash_find(const struct Hash *table, const char *strkey) { - union hash_key key; + union HashKey key; key.strkey = strkey; return union_hash_find(table, key); } struct HashElem *hash_find_elem(const struct Hash *table, const char *strkey) { - union hash_key key; + union HashKey key; key.strkey = strkey; return union_hash_find_elem(table, key); } void *int_hash_find(const struct Hash *table, unsigned int intkey) { - union hash_key key; + union HashKey key; key.intkey = intkey; return union_hash_find(table, key); } struct HashElem *hash_find_bucket(const struct Hash *table, const char *strkey) { - union hash_key key; + union HashKey key; int hash; if (!table) @@ -256,7 +256,7 @@ struct HashElem *hash_find_bucket(const struct Hash *table, const char *strkey) return table->table[hash]; } -static void union_hash_delete(struct Hash *table, union hash_key key, +static void union_hash_delete(struct Hash *table, union HashKey key, const void *data, void (*destroy)(void *)) { int hash; @@ -294,7 +294,7 @@ static void union_hash_delete(struct Hash *table, union hash_key key, void hash_delete(struct Hash *table, const char *strkey, const void *data, void (*destroy)(void *)) { - union hash_key key; + union HashKey key; key.strkey = strkey; union_hash_delete(table, key, data, destroy); } @@ -302,7 +302,7 @@ void hash_delete(struct Hash *table, const char *strkey, const void *data, void int_hash_delete(struct Hash *table, unsigned int intkey, const void *data, void (*destroy)(void *)) { - union hash_key key; + union HashKey key; key.intkey = intkey; union_hash_delete(table, key, data, destroy); } diff --git a/hash.h b/hash.h index 66bb29ce0..d72dbb1f0 100644 --- a/hash.h +++ b/hash.h @@ -20,14 +20,14 @@ #include -union hash_key { +union HashKey { const char *strkey; unsigned int intkey; }; struct HashElem { - union hash_key key; + union HashKey key; void *data; struct HashElem *next; }; @@ -38,8 +38,8 @@ struct Hash bool strdup_keys : 1; /* if set, the key->strkey is strdup'ed */ bool allow_dups : 1; /* if set, duplicate keys are allowed */ struct HashElem **table; - unsigned int (*gen_hash)(union hash_key, unsigned int); - int (*cmp_key)(union hash_key, union hash_key); + unsigned int (*gen_hash)(union HashKey, unsigned int); + int (*cmp_key)(union HashKey, union HashKey); }; /* flags for hash_create() */ diff --git a/hcache/backend.h b/hcache/backend.h index c8b086a62..36d0b9a85 100644 --- a/hcache/backend.h +++ b/hcache/backend.h @@ -96,7 +96,7 @@ typedef void (*hcache_close_t)(void **ctx); */ typedef const char *(*hcache_backend_t)(void); -typedef struct +struct HcacheOps { const char *name; hcache_open_t open; @@ -106,7 +106,7 @@ typedef struct hcache_delete_t delete; hcache_close_t close; hcache_backend_t backend; -} hcache_ops_t; +}; #define HCACHE_BACKEND_LIST \ HCACHE_BACKEND(bdb) \ @@ -117,15 +117,15 @@ typedef struct HCACHE_BACKEND(tokyocabinet) #define HCACHE_BACKEND_OPS(_name) \ - const hcache_ops_t hcache_##_name##_ops = { \ - .name = #_name, \ - .open = hcache_##_name##_open, \ - .fetch = hcache_##_name##_fetch, \ - .free = hcache_##_name##_free, \ - .store = hcache_##_name##_store, \ - .delete = hcache_##_name##_delete, \ - .close = hcache_##_name##_close, \ - .backend = hcache_##_name##_backend, \ + const struct HcacheOps hcache_##_name##_ops = { \ + .name = #_name, \ + .open = hcache_##_name##_open, \ + .fetch = hcache_##_name##_fetch, \ + .free = hcache_##_name##_free, \ + .store = hcache_##_name##_store, \ + .delete = hcache_##_name##_delete, \ + .close = hcache_##_name##_close, \ + .backend = hcache_##_name##_backend, \ }; #endif /* _MUTT_HCACHE_BACKEND_H */ diff --git a/hcache/hcache.c b/hcache/hcache.c index d807b7e3c..5443f5a45 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -56,7 +56,7 @@ static unsigned int hcachever = 0x0; /** - * header_cache_t - header cache structure. + * struct HeaderCache - header cache structure * * This struct holds both the backend-agnostic and the backend-specific parts * of the header cache. Backend code MUST initialize the fetch, store, @@ -70,18 +70,18 @@ struct HeaderCache void *ctx; }; -typedef union { +union Validate { struct timeval timeval; unsigned int uidvalidity; -} validate; +}; -#define HCACHE_BACKEND(name) extern const hcache_ops_t hcache_##name##_ops; +#define HCACHE_BACKEND(name) extern const struct HcacheOps hcache_##name##_ops; HCACHE_BACKEND_LIST #undef HCACHE_BACKEND /* Keep this list sorted as it is in configure.ac to avoid user surprise if no * header_cache_backend is specified. */ -const hcache_ops_t *hcache_ops[] = { +const struct HcacheOps *hcache_ops[] = { #ifdef HAVE_TC &hcache_tokyocabinet_ops, #endif @@ -103,9 +103,9 @@ const hcache_ops_t *hcache_ops[] = { NULL, }; -static const hcache_ops_t *hcache_get_backend_ops(const char *backend) +static const struct HcacheOps *hcache_get_backend_ops(const char *backend) { - const hcache_ops_t **ops = hcache_ops; + const struct HcacheOps **ops = hcache_ops; if (!backend || !*backend) { @@ -513,7 +513,7 @@ static void restore_envelope(struct Envelope *e, const unsigned char *d, int *of static int crc_matches(const char *d, unsigned int crc) { - int off = sizeof(validate); + int off = sizeof(union Validate); unsigned int mycrc = 0; if (!d) @@ -636,7 +636,7 @@ static void *hcache_dump(header_cache_t *h, struct Header *header, int *off, int convert = !Charset_is_utf8; *off = 0; - d = lazy_malloc(sizeof(validate)); + d = lazy_malloc(sizeof(union Validate)); if (uidvalidity == 0) { @@ -646,7 +646,7 @@ static void *hcache_dump(header_cache_t *h, struct Header *header, int *off, } else memcpy(d, &uidvalidity, sizeof(uidvalidity)); - *off += sizeof(validate); + *off += sizeof(union Validate); d = dump_int(h->crc, d, off); @@ -693,7 +693,7 @@ struct Header *mutt_hcache_restore(const unsigned char *d) int convert = !Charset_is_utf8; /* skip validate */ - off += sizeof(validate); + off += sizeof(union Validate); /* skip crc */ off += sizeof(unsigned int); @@ -730,7 +730,7 @@ static char *get_foldername(const char *folder) header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) { - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!ops) return NULL; @@ -805,7 +805,7 @@ header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_na void mutt_hcache_close(header_cache_t *h) { - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!h || !ops) return; @@ -836,7 +836,7 @@ void *mutt_hcache_fetch(header_cache_t *h, const char *key, size_t keylen) void *mutt_hcache_fetch_raw(header_cache_t *h, const char *key, size_t keylen) { char path[_POSIX_PATH_MAX]; - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!h || !ops) return NULL; @@ -848,7 +848,7 @@ void *mutt_hcache_fetch_raw(header_cache_t *h, const char *key, size_t keylen) void mutt_hcache_free(header_cache_t *h, void **data) { - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!h || !ops) return; @@ -878,7 +878,7 @@ int mutt_hcache_store_raw(header_cache_t *h, const char *key, size_t keylen, void *data, size_t dlen) { char path[_POSIX_PATH_MAX]; - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!h || !ops) return -1; @@ -891,7 +891,7 @@ int mutt_hcache_store_raw(header_cache_t *h, const char *key, size_t keylen, int mutt_hcache_delete(header_cache_t *h, const char *key, size_t keylen) { char path[_POSIX_PATH_MAX]; - const hcache_ops_t *ops = hcache_get_ops(); + const struct HcacheOps *ops = hcache_get_ops(); if (!h) return -1; @@ -904,7 +904,7 @@ int mutt_hcache_delete(header_cache_t *h, const char *key, size_t keylen) const char *mutt_hcache_backend_list(void) { char tmp[STRING] = { 0 }; - const hcache_ops_t **ops = hcache_ops; + const struct HcacheOps **ops = hcache_ops; size_t len = 0; for (; *ops; ++ops) diff --git a/hcache/lmdb.c b/hcache/lmdb.c index 29fef9dac..69e56d92d 100644 --- a/hcache/lmdb.c +++ b/hcache/lmdb.c @@ -28,11 +28,11 @@ * The file is mmap(2)'d into memory. */ const size_t LMDB_DB_SIZE = 2147483648; -enum mdb_txn_mode +enum MdbTxnMode { - txn_uninitialized, - txn_read, - txn_write + TXN_UNINITIALIZED, + TXN_READ, + TXN_WRITE }; struct HcacheLmdbCtx @@ -40,14 +40,14 @@ struct HcacheLmdbCtx MDB_env *env; MDB_txn *txn; MDB_dbi db; - enum mdb_txn_mode txn_mode; + enum MdbTxnMode txn_mode; }; static int mdb_get_r_txn(struct HcacheLmdbCtx *ctx) { int rc; - if (ctx->txn && (ctx->txn_mode == txn_read || ctx->txn_mode == txn_write)) + if (ctx->txn && (ctx->txn_mode == TXN_READ || ctx->txn_mode == TXN_WRITE)) return MDB_SUCCESS; if (ctx->txn) @@ -56,7 +56,7 @@ static int mdb_get_r_txn(struct HcacheLmdbCtx *ctx) rc = mdb_txn_begin(ctx->env, NULL, MDB_RDONLY, &ctx->txn); if (rc == MDB_SUCCESS) - ctx->txn_mode = txn_read; + ctx->txn_mode = TXN_READ; else mutt_debug(2, "mdb_get_r_txn: %s: %s\n", ctx->txn ? "mdb_txn_renew" : "mdb_txn_begin", mdb_strerror(rc)); @@ -70,7 +70,7 @@ static int mdb_get_w_txn(struct HcacheLmdbCtx *ctx) if (ctx->txn) { - if (ctx->txn_mode == txn_write) + if (ctx->txn_mode == TXN_WRITE) return MDB_SUCCESS; /* Free up the memory for readonly or reset transactions */ @@ -79,7 +79,7 @@ static int mdb_get_w_txn(struct HcacheLmdbCtx *ctx) rc = mdb_txn_begin(ctx->env, NULL, 0, &ctx->txn); if (rc == MDB_SUCCESS) - ctx->txn_mode = txn_write; + ctx->txn_mode = TXN_WRITE; else mutt_debug(2, "mdb_get_w_txn: mdb_txn_begin: %s\n", mdb_strerror(rc)); @@ -126,12 +126,12 @@ static void *hcache_lmdb_open(const char *path) } mdb_txn_reset(ctx->txn); - ctx->txn_mode = txn_uninitialized; + ctx->txn_mode = TXN_UNINITIALIZED; return ctx; fail_dbi: mdb_txn_abort(ctx->txn); - ctx->txn_mode = txn_uninitialized; + ctx->txn_mode = TXN_UNINITIALIZED; ctx->txn = NULL; fail_env: @@ -207,7 +207,7 @@ static int hcache_lmdb_store(void *vctx, const char *key, size_t keylen, void *d { mutt_debug(2, "hcahce_lmdb_store: mdb_put: %s\n", mdb_strerror(rc)); mdb_txn_abort(ctx->txn); - ctx->txn_mode = txn_uninitialized; + ctx->txn_mode = TXN_UNINITIALIZED; ctx->txn = NULL; return rc; } @@ -239,7 +239,7 @@ static int hcache_lmdb_delete(void *vctx, const char *key, size_t keylen) { mutt_debug(2, "hcache_lmdb_delete: mdb_del: %s\n", mdb_strerror(rc)); mdb_txn_abort(ctx->txn); - ctx->txn_mode = txn_uninitialized; + ctx->txn_mode = TXN_UNINITIALIZED; ctx->txn = NULL; } return rc; @@ -255,10 +255,10 @@ static void hcache_lmdb_close(void **vctx) struct HcacheLmdbCtx *ctx = *vctx; - if (ctx->txn && ctx->txn_mode == txn_write) + if (ctx->txn && ctx->txn_mode == TXN_WRITE) { mdb_txn_commit(ctx->txn); - ctx->txn_mode = txn_uninitialized; + ctx->txn_mode = TXN_UNINITIALIZED; ctx->txn = NULL; } diff --git a/hdrline.c b/hdrline.c index d58425887..8cf2a4d91 100644 --- a/hdrline.c +++ b/hdrline.c @@ -135,7 +135,7 @@ static bool first_mailing_list(char *buf, size_t buflen, struct Address *a) * arguments. * Returns the number of chars written. */ -static size_t add_index_color(char *buf, size_t buflen, format_flag flags, char color) +static size_t add_index_color(char *buf, size_t buflen, enum FormatFlag flags, char color) { int len; @@ -474,7 +474,7 @@ static char *apply_subject_mods(struct Envelope *env) static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data; struct Header *hdr = NULL, *htmp = NULL; @@ -1319,7 +1319,7 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co } void _mutt_make_string(char *dest, size_t destlen, const char *s, - struct Context *ctx, struct Header *hdr, format_flag flags) + struct Context *ctx, struct Header *hdr, enum FormatFlag flags) { struct HdrFormatInfo hfi; @@ -1332,7 +1332,7 @@ void _mutt_make_string(char *dest, size_t destlen, const char *s, } void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s, - struct HdrFormatInfo *hfi, format_flag flags) + struct HdrFormatInfo *hfi, enum FormatFlag flags) { mutt_FormatString(dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long) hfi, flags); } diff --git a/history.c b/history.c index 76d46ebdd..f4d67530d 100644 --- a/history.c +++ b/history.c @@ -273,7 +273,7 @@ cleanup: hash_destroy(&dup_hashes[hclass], NULL); } -static void save_history(history_class_t hclass, const char *s) +static void save_history(enum HistoryClass hclass, const char *s) { static int n = 0; FILE *f = NULL; @@ -317,7 +317,7 @@ static void save_history(history_class_t hclass, const char *s) /* When removing dups, we want the created "blanks" to be right below the * resulting h->last position. See the comment section above 'struct History'. */ -static void remove_history_dups(history_class_t hclass, const char *s) +static void remove_history_dups(enum HistoryClass hclass, const char *s) { int source, dest, old_last; struct History *h = GET_HISTORY(hclass); @@ -364,13 +364,13 @@ void mutt_init_history(void) if (HistSize == OldSize) return; - for (history_class_t hclass = HC_FIRST; hclass < HC_LAST; hclass++) + for (enum HistoryClass hclass = HC_FIRST; hclass < HC_LAST; hclass++) init_history(&History[hclass]); OldSize = HistSize; } -void mutt_history_add(history_class_t hclass, const char *s, int save) +void mutt_history_add(enum HistoryClass hclass, const char *s, int save) { int prev; struct History *h = GET_HISTORY(hclass); @@ -402,7 +402,7 @@ void mutt_history_add(history_class_t hclass, const char *s, int save) h->cur = h->last; /* reset to the last entry */ } -char *mutt_history_next(history_class_t hclass) +char *mutt_history_next(enum HistoryClass hclass) { int next; struct History *h = GET_HISTORY(hclass); @@ -424,7 +424,7 @@ char *mutt_history_next(history_class_t hclass) return (h->hist[h->cur] ? h->hist[h->cur] : ""); } -char *mutt_history_prev(history_class_t hclass) +char *mutt_history_prev(enum HistoryClass hclass) { int prev; struct History *h = GET_HISTORY(hclass); @@ -446,7 +446,7 @@ char *mutt_history_prev(history_class_t hclass) return (h->hist[h->cur] ? h->hist[h->cur] : ""); } -void mutt_reset_history_state(history_class_t hclass) +void mutt_reset_history_state(enum HistoryClass hclass) { struct History *h = GET_HISTORY(hclass); @@ -456,7 +456,7 @@ void mutt_reset_history_state(history_class_t hclass) h->cur = h->last; } -int mutt_history_at_scratch(history_class_t hclass) +int mutt_history_at_scratch(enum HistoryClass hclass) { struct History *h = GET_HISTORY(hclass); @@ -466,7 +466,7 @@ int mutt_history_at_scratch(history_class_t hclass) return h->cur == h->last; } -void mutt_history_save_scratch(history_class_t hclass, const char *s) +void mutt_history_save_scratch(enum HistoryClass hclass, const char *s) { struct History *h = GET_HISTORY(hclass); diff --git a/history.h b/history.h index 0a8c46390..e3d5eb038 100644 --- a/history.h +++ b/history.h @@ -18,7 +18,7 @@ #ifndef _MUTT_HISTORY_H #define _MUTT_HISTORY_H 1 -typedef enum history_class +enum HistoryClass { HC_CMD, HC_ALIAS, @@ -29,17 +29,17 @@ typedef enum history_class HC_MBOX, /* insert new items here to keep history file working */ HC_LAST -} history_class_t; +}; #define HC_FIRST HC_CMD void mutt_init_history(void); void mutt_read_histfile(void); -void mutt_history_add(history_class_t hclass, const char *s, int save); -char *mutt_history_next(history_class_t hclass); -char *mutt_history_prev(history_class_t hclass); -void mutt_reset_history_state(history_class_t hclass); -int mutt_history_at_scratch(history_class_t hclass); -void mutt_history_save_scratch(history_class_t hclass, const char *s); +void mutt_history_add(enum HistoryClass hclass, const char *s, int save); +char *mutt_history_next(enum HistoryClass hclass); +char *mutt_history_prev(enum HistoryClass hclass); +void mutt_reset_history_state(enum HistoryClass hclass); +int mutt_history_at_scratch(enum HistoryClass hclass); +void mutt_history_save_scratch(enum HistoryClass hclass, const char *s); #endif /* _MUTT_HISTORY_H */ diff --git a/imap/auth.h b/imap/auth.h index bc50e3421..baf2d85f5 100644 --- a/imap/auth.h +++ b/imap/auth.h @@ -23,33 +23,34 @@ struct ImapData; -typedef enum { +enum ImapAuthRes +{ IMAP_AUTH_SUCCESS = 0, IMAP_AUTH_FAILURE, IMAP_AUTH_UNAVAIL -} imap_auth_res_t; +}; struct ImapAuth { /* do authentication, using named method or any available if method is NULL */ - imap_auth_res_t (*authenticate)(struct ImapData *idata, const char *method); + enum ImapAuthRes (*authenticate)(struct ImapData *idata, const char *method); /* name of authentication method supported, NULL means variable. If this * is not null, authenticate may ignore the second parameter. */ const char *method; }; /* external authenticator prototypes */ -imap_auth_res_t imap_auth_plain(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method); #ifndef USE_SASL -imap_auth_res_t imap_auth_anon(struct ImapData *idata, const char *method); -imap_auth_res_t imap_auth_cram_md5(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_anon(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method); #endif -imap_auth_res_t imap_auth_login(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method); #ifdef USE_GSS -imap_auth_res_t imap_auth_gss(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_gss(struct ImapData *idata, const char *method); #endif #ifdef USE_SASL -imap_auth_res_t imap_auth_sasl(struct ImapData *idata, const char *method); +enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method); #endif #endif /* _MUTT_IMAP_AUTH_H */ diff --git a/imap/auth_anon.c b/imap/auth_anon.c index d71ce38c1..d7ec0503a 100644 --- a/imap/auth_anon.c +++ b/imap/auth_anon.c @@ -28,7 +28,7 @@ #include "protos.h" /* this is basically a stripped-down version of the cram-md5 method. */ -imap_auth_res_t imap_auth_anon(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_anon(struct ImapData *idata, const char *method) { int rc; diff --git a/imap/auth_cram.c b/imap/auth_cram.c index f9728c401..f9af0c5fc 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -37,7 +37,7 @@ static void hmac_md5(const char *password, char *challenge, unsigned char *response); /* imap_auth_cram_md5: AUTH=CRAM-MD5 support. */ -imap_auth_res_t imap_auth_cram_md5(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method) { char ibuf[LONG_STRING * 2], obuf[LONG_STRING]; unsigned char hmac_response[MD5_DIGEST_LEN]; diff --git a/imap/auth_gss.c b/imap/auth_gss.c index 0d74790e1..c927860be 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -72,7 +72,7 @@ static void print_gss_error(OM_uint32 err_maj, OM_uint32 err_min) } /* imap_auth_gss: AUTH=GSSAPI support. */ -imap_auth_res_t imap_auth_gss(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_gss(struct ImapData *idata, const char *method) { gss_buffer_desc request_buf, send_token; gss_buffer_t sec_token; diff --git a/imap/auth_login.c b/imap/auth_login.c index 28f1c5e15..e271aa1fd 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -29,7 +29,7 @@ #include "protos.h" /* imap_auth_login: Plain LOGIN support */ -imap_auth_res_t imap_auth_login(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method) { char q_user[SHORT_STRING], q_pass[SHORT_STRING]; char buf[STRING]; diff --git a/imap/auth_plain.c b/imap/auth_plain.c index ccf4994dc..43147af19 100644 --- a/imap/auth_plain.c +++ b/imap/auth_plain.c @@ -29,10 +29,10 @@ #include "protos.h" /* imap_auth_plain: SASL PLAIN support */ -imap_auth_res_t imap_auth_plain(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method) { int rc; - imap_auth_res_t res = IMAP_AUTH_SUCCESS; + enum ImapAuthRes res = IMAP_AUTH_SUCCESS; char buf[STRING]; if (mutt_account_getuser(&idata->conn->account)) diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 99790e332..fcfb16499 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -35,7 +35,7 @@ #include "protos.h" /* imap_auth_sasl: Default authenticator if available. */ -imap_auth_res_t imap_auth_sasl(struct ImapData *idata, const char *method) +enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method) { sasl_conn_t *saslconn = NULL; sasl_interact_t *interaction = NULL; diff --git a/imap/command.c b/imap/command.c index 06292304f..c4c9cc34e 100644 --- a/imap/command.c +++ b/imap/command.c @@ -56,13 +56,13 @@ static const char *const Capabilities[] = { }; /* Gmail document one string but use another. Support both. */ -struct Capability_Alias +struct CapabilityAlias { char *name; unsigned int value; }; -static struct Capability_Alias Capability_Aliases[] = { +static struct CapabilityAlias CapabilityAliases[] = { { "X-GM-EXT-1", X_GM_EXT1 }, { NULL, 0 }, }; @@ -311,13 +311,13 @@ static void cmd_parse_capability(struct ImapData *idata, char *s) } if (!found) { - for (x = 0; Capability_Aliases[x].name != NULL; x++) + for (x = 0; CapabilityAliases[x].name != NULL; x++) { - if (imap_wordcasecmp(Capability_Aliases[x].name, s) == 0) + if (imap_wordcasecmp(CapabilityAliases[x].name, s) == 0) { - mutt_bit_set(idata->capabilities, Capability_Aliases[x].value); + mutt_bit_set(idata->capabilities, CapabilityAliases[x].value); mutt_debug(4, " Found capability \"%s\": %d\n", - Capability_Aliases[x].name, Capability_Aliases[x].value); + CapabilityAliases[x].name, CapabilityAliases[x].value); found = true; break; } @@ -740,7 +740,7 @@ static int cmd_handle_untagged(struct ImapData *idata) idata->mailbox, count); idata->reopen |= IMAP_NEWMAIL_PENDING; } - idata->newMailCount = count; + idata->new_mail_count = count; } } /* pn vs. s: need initial seqno */ @@ -1003,7 +1003,7 @@ void imap_cmd_finish(struct ImapData *idata) if (idata->reopen & IMAP_REOPEN_ALLOW) { - unsigned int count = idata->newMailCount; + unsigned int count = idata->new_mail_count; if (!(idata->reopen & IMAP_EXPUNGE_PENDING) && (idata->reopen & IMAP_NEWMAIL_PENDING) && count > idata->max_msn) diff --git a/imap/imap.c b/imap/imap.c index c487dc420..746bdc4df 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -619,7 +619,7 @@ static int imap_open_mailbox(struct Context *ctx) /* clear mailbox status */ idata->status = false; memset(idata->ctx->rights, 0, sizeof(idata->ctx->rights)); - idata->newMailCount = 0; + idata->new_mail_count = 0; idata->max_msn = 0; mutt_message(_("Selecting %s..."), idata->mailbox); @@ -713,8 +713,8 @@ static int imap_open_mailbox(struct Context *ctx) pc = imap_next_word(pc); if (ascii_strncasecmp("EXISTS", pc, 6) == 0) { - count = idata->newMailCount; - idata->newMailCount = 0; + count = idata->new_mail_count; + idata->new_mail_count = 0; } } } while (rc == IMAP_CMD_CONTINUE); diff --git a/imap/imap_private.h b/imap/imap_private.h index 40db483c4..4189e0133 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -167,11 +167,12 @@ struct ImapCommand int state; }; -typedef enum { +enum ImapCommandType +{ IMAP_CT_NONE = 0, IMAP_CT_LIST, IMAP_CT_STATUS -} IMAP_COMMAND_TYPE; +}; struct ImapData { @@ -201,7 +202,7 @@ struct ImapData /* if set, the response parser will store results for complicated commands * here. */ - IMAP_COMMAND_TYPE cmdtype; + enum ImapCommandType cmdtype; void *cmddata; /* command queue */ @@ -220,7 +221,7 @@ struct ImapData char *mailbox; unsigned short check_status; unsigned char reopen; - unsigned int newMailCount; /* Set when EXISTS notifies of new mail */ + unsigned int new_mail_count; /* Set when EXISTS notifies of new mail */ struct ImapCache cache[IMAP_CACHE_LEN]; struct Hash *uid_hash; unsigned int uid_validity; diff --git a/imap/message.c b/imap/message.c index 367f95936..af117c658 100644 --- a/imap/message.c +++ b/imap/message.c @@ -523,7 +523,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i idx = ctx->msgcount; oldmsgcount = ctx->msgcount; idata->reopen &= ~(IMAP_REOPEN_ALLOW | IMAP_NEWMAIL_PENDING); - idata->newMailCount = 0; + idata->new_mail_count = 0; #ifdef USE_HCACHE idata->hcache = imap_hcache_open(idata, NULL); @@ -772,12 +772,12 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i /* update to the last value we actually pulled down */ fetch_msn_end = idata->max_msn; msn_begin = idata->max_msn + 1; - msn_end = idata->newMailCount; + msn_end = idata->new_mail_count; while (msn_end > ctx->hdrmax) mx_alloc_memory(ctx); imap_alloc_msn_index(idata, msn_end); idata->reopen &= ~IMAP_NEWMAIL_PENDING; - idata->newMailCount = 0; + idata->new_mail_count = 0; } } diff --git a/init.c b/init.c index c5fabfda9..837623d88 100644 --- a/init.c +++ b/init.c @@ -1268,13 +1268,18 @@ bail: return -1; } -typedef enum group_state_t { NONE, RX, ADDR } group_state_t; +enum GroupState +{ + GS_NONE, + GS_RX, + GS_ADDR +}; static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { struct GroupContext *gc = NULL; - group_state_t state = NONE; + enum GroupState state = GS_NONE; struct Address *addr = NULL; char *estr = NULL; @@ -1292,19 +1297,19 @@ static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data, } if (mutt_strcasecmp(buf->data, "-rx") == 0) - state = RX; + state = GS_RX; else if (mutt_strcasecmp(buf->data, "-addr") == 0) - state = ADDR; + state = GS_ADDR; else { switch (state) { - case NONE: + case GS_NONE: snprintf(err->data, err->dsize, _("%sgroup: missing -rx or -addr."), data == MUTT_UNGROUP ? "un" : ""); goto bail; - case RX: + case GS_RX: if (data == MUTT_GROUP && mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0) goto bail; @@ -1312,7 +1317,7 @@ static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data, goto bail; break; - case ADDR: + case GS_ADDR: if ((addr = mutt_parse_adrlist(NULL, buf->data)) == NULL) goto bail; if (mutt_addrlist_to_intl(addr, &estr)) @@ -4234,7 +4239,7 @@ void mutt_init(int skip_sys_rc, struct List *commands) { do { - if (mutt_set_xdg_path(kXDGConfigDirs, buffer, sizeof(buffer))) + if (mutt_set_xdg_path(XDG_CONFIG_DIRS, buffer, sizeof(buffer))) break; snprintf(buffer, sizeof(buffer), "%s/neomuttrc-%s", SYSCONFDIR, PACKAGE_VERSION); diff --git a/init.h b/init.h index ed547a6c0..b09addc3b 100644 --- a/init.h +++ b/init.h @@ -53,7 +53,7 @@ struct Buffer; #define R_NONE 0 #define R_INDEX (1 << 0) /* redraw the index menu (MENU_MAIN) */ #define R_PAGER (1 << 1) /* redraw the pager menu */ -#define R_PAGER_FLOW (1 << 2) /* reflow lineInfo and redraw the pager menu */ +#define R_PAGER_FLOW (1 << 2) /* reflow line_info and redraw the pager menu */ #define R_RESORT (1 << 3) /* resort the mailbox */ #define R_RESORT_SUB (1 << 4) /* resort subthreads */ #define R_RESORT_INIT (1 << 5) /* resort from scratch */ diff --git a/lib.c b/lib.c index d2364242f..7b85b2054 100644 --- a/lib.c +++ b/lib.c @@ -44,7 +44,7 @@ #define EX_OK 0 #endif -static const struct Sysexits +static const struct SysExits { int v; const char *str; diff --git a/menu.c b/menu.c index 3f6d6aaed..e42ed3c30 100644 --- a/menu.c +++ b/menu.c @@ -914,7 +914,7 @@ void mutt_current_menu_redraw() static int menu_search(struct Menu *menu, int op) { int r = 0, wrap = 0; - int searchDir; + int search_dir; regex_t re; char buf[SHORT_STRING]; char *searchBuf = @@ -934,12 +934,12 @@ static int menu_search(struct Menu *menu, int op) mutt_str_replace(&SearchBuffers[menu->menu], buf); searchBuf = SearchBuffers[menu->menu]; } - menu->searchDir = (op == OP_SEARCH || op == OP_SEARCH_NEXT) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP; + menu->search_dir = (op == OP_SEARCH || op == OP_SEARCH_NEXT) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP; } - searchDir = (menu->searchDir == MUTT_SEARCH_UP) ? -1 : 1; + search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1; if (op == OP_SEARCH_OPPOSITE) - searchDir = -searchDir; + search_dir = -search_dir; if (searchBuf) r = REGCOMP(&re, searchBuf, REG_NOSUB | mutt_which_case(searchBuf)); @@ -951,7 +951,7 @@ static int menu_search(struct Menu *menu, int op) return -1; } - r = menu->current + searchDir; + r = menu->current + search_dir; search_next: if (wrap) mutt_message(_("Search wrapped to top.")); @@ -963,12 +963,12 @@ search_next: return r; } - r += searchDir; + r += search_dir; } if (option(OPTWRAPSEARCH) && wrap++ == 0) { - r = searchDir == 1 ? 0 : menu->max - 1; + r = search_dir == 1 ? 0 : menu->max - 1; goto search_next; } regfree(&re); diff --git a/mutt_menu.h b/mutt_menu.h index b26b49bae..263da3d46 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -87,7 +87,7 @@ struct Menu /* the following are used only by mutt_menu_loop() */ int top; /* entry that is the top of the current page */ int oldcurrent; /* for driver use only. */ - int searchDir; /* direction of search */ + int search_dir; /* direction of search */ int tagged; /* number of tagged entries */ }; diff --git a/mutt_notmuch.c b/mutt_notmuch.c index d8713a2b4..5a0eda1dd 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -90,7 +90,7 @@ enum * * The arguments in a URI are saved in a linked list. * - * @sa nm_ctxdata#query_items + * @sa NmCtxData#query_items */ struct UriTag { @@ -100,46 +100,46 @@ struct UriTag }; /** - * nm_hdrtag - NotMuch Mail Header Tags + * struct NmHdrTag - NotMuch Mail Header Tags * * Keep a linked list of header tags and their transformed values. * Textual tags can be transformed to symbols to save space. * - * @sa nm_hdrdata#tag_list + * @sa NmHdrData#tag_list */ -struct NmHdrtag +struct NmHdrTag { char *tag; char *transformed; - struct NmHdrtag *next; + struct NmHdrTag *next; }; /** - * struct NmHdrdata - NotMuch data attached to an email + * struct NmHdrData - NotMuch data attached to an email * * This stores all the NotMuch data associated with an email. * * @sa Header#data, MUTT_MBOX */ -struct NmHdrdata +struct NmHdrData { char *folder; /**< Location of the email */ char *tags; char *tags_transformed; - struct NmHdrtag *tag_list; + struct NmHdrTag *tag_list; char *oldpath; char *virtual_id; /**< Unique NotMuch Id */ int magic; /**< Type of mailbox the email is in */ }; /** - * struct NmCtxdata - NotMuch data attached to a context + * struct NmCtxData - NotMuch data attached to a context * * This stores the global NotMuch data, such as the database connection. * * @sa Context#data, NotmuchDBLimit, NM_QUERY_TYPE_MESGS */ -struct NmCtxdata +struct NmCtxData { notmuch_database_t *db; @@ -302,9 +302,9 @@ err: return false; } -static void free_tag_list(struct NmHdrtag **tag_list) +static void free_tag_list(struct NmHdrTag **tag_list) { - struct NmHdrtag *tmp = NULL; + struct NmHdrTag *tmp = NULL; while ((tmp = *tag_list) != NULL) { @@ -317,7 +317,7 @@ static void free_tag_list(struct NmHdrtag **tag_list) *tag_list = 0; } -static void free_hdrdata(struct NmHdrdata *data) +static void free_hdrdata(struct NmHdrData *data) { if (!data) return; @@ -332,7 +332,7 @@ static void free_hdrdata(struct NmHdrdata *data) FREE(&data); } -static void free_ctxdata(struct NmCtxdata *data) +static void free_ctxdata(struct NmCtxData *data) { if (!data) return; @@ -353,14 +353,14 @@ static void free_ctxdata(struct NmCtxdata *data) FREE(&data); } -static struct NmCtxdata *new_ctxdata(char *uri) +static struct NmCtxData *new_ctxdata(char *uri) { - struct NmCtxdata *data = NULL; + struct NmCtxData *data = NULL; if (!uri) return NULL; - data = safe_calloc(1, sizeof(struct NmCtxdata)); + data = safe_calloc(1, sizeof(struct NmCtxData)); mutt_debug(1, "nm: initialize context data %p\n", (void *) data); data->db_limit = NotmuchDBLimit; @@ -392,7 +392,7 @@ static int init_context(struct Context *ctx) static char *header_get_id(struct Header *h) { - return (h && h->data) ? ((struct NmHdrdata *) h->data)->virtual_id : NULL; + return (h && h->data) ? ((struct NmHdrData *) h->data)->virtual_id : NULL; } static char *header_get_fullpath(struct Header *h, char *buf, size_t bufsz) @@ -401,7 +401,7 @@ static char *header_get_fullpath(struct Header *h, char *buf, size_t bufsz) return buf; } -static struct NmCtxdata *get_ctxdata(struct Context *ctx) +static struct NmCtxData *get_ctxdata(struct Context *ctx) { if (ctx && (ctx->magic == MUTT_NOTMUCH)) return ctx->data; @@ -556,7 +556,7 @@ static bool windowed_query_from_query(const char *query, char *buf, size_t bufsz * result in buffy) or not (for the count in the sidebar). It is not aimed at * enabling/disabling the feature. */ -static char *get_query_string(struct NmCtxdata *data, int window) +static char *get_query_string(struct NmCtxData *data, int window) { mutt_debug(2, "nm: get_query_string(%d)\n", window); @@ -611,17 +611,17 @@ static char *get_query_string(struct NmCtxdata *data, int window) return data->db_query; } -static int get_limit(struct NmCtxdata *data) +static int get_limit(struct NmCtxData *data) { return data ? data->db_limit : 0; } -static int get_query_type(struct NmCtxdata *data) +static int get_query_type(struct NmCtxData *data) { return (data && data->query_type) ? data->query_type : string_to_query_type(NULL); } -static const char *get_db_filename(struct NmCtxdata *data) +static const char *get_db_filename(struct NmCtxData *data) { char *db_filename = NULL; @@ -678,7 +678,7 @@ static notmuch_database_t *do_database_open(const char *filename, int writable, return db; } -static notmuch_database_t *get_db(struct NmCtxdata *data, int writable) +static notmuch_database_t *get_db(struct NmCtxData *data, int writable) { if (!data) return NULL; @@ -692,7 +692,7 @@ static notmuch_database_t *get_db(struct NmCtxdata *data, int writable) return data->db; } -static int release_db(struct NmCtxdata *data) +static int release_db(struct NmCtxData *data) { if (data && data->db) { @@ -710,7 +710,7 @@ static int release_db(struct NmCtxdata *data) return -1; } -static int db_trans_begin(struct NmCtxdata *data) +static int db_trans_begin(struct NmCtxData *data) { if (!data || !data->db) return -1; @@ -727,7 +727,7 @@ static int db_trans_begin(struct NmCtxdata *data) return 0; } -static int db_trans_end(struct NmCtxdata *data) +static int db_trans_end(struct NmCtxData *data) { if (!data || !data->db) return -1; @@ -743,12 +743,12 @@ static int db_trans_end(struct NmCtxdata *data) return 0; } -static int is_longrun(struct NmCtxdata *data) +static int is_longrun(struct NmCtxData *data) { return data && data->longrun; } -static int get_database_mtime(struct NmCtxdata *data, time_t *mtime) +static int get_database_mtime(struct NmCtxData *data, time_t *mtime) { char path[_POSIX_PATH_MAX]; struct stat st; @@ -800,7 +800,7 @@ static void apply_exclude_tags(notmuch_query_t *query) FREE(&buf); } -static notmuch_query_t *get_query(struct NmCtxdata *data, int writable) +static notmuch_query_t *get_query(struct NmCtxData *data, int writable) { notmuch_database_t *db = NULL; notmuch_query_t *q = NULL; @@ -844,10 +844,10 @@ static void append_str_item(char **str, const char *item, int sep) static int update_header_tags(struct Header *h, notmuch_message_t *msg) { - struct NmHdrdata *data = h->data; + struct NmHdrData *data = h->data; notmuch_tags_t *tags = NULL; char *tstr = NULL, *ttstr = NULL; - struct NmHdrtag *tag_list = NULL, *tmp = NULL; + struct NmHdrTag *tag_list = NULL, *tmp = NULL; mutt_debug(2, "nm: tags update requested (%s)\n", data->virtual_id); @@ -916,7 +916,7 @@ static int update_header_tags(struct Header *h, notmuch_message_t *msg) static int update_message_path(struct Header *h, const char *path) { - struct NmHdrdata *data = h->data; + struct NmHdrData *data = h->data; char *p = NULL; mutt_debug(2, "nm: path update requested path=%s, (%s)\n", path, data->virtual_id); @@ -996,14 +996,14 @@ static int init_header(struct Header *h, const char *path, notmuch_message_t *ms id = notmuch_message_get_message_id(msg); - h->data = safe_calloc(1, sizeof(struct NmHdrdata)); + h->data = safe_calloc(1, sizeof(struct NmHdrData)); h->free_cb = deinit_header; /* * Notmuch ensures that message Id exists (if not notmuch Notmuch will * generate an ID), so it's more safe than use mutt Header->env->id */ - ((struct NmHdrdata *) h->data)->virtual_id = safe_strdup(id); + ((struct NmHdrData *) h->data)->virtual_id = safe_strdup(id); mutt_debug(2, "nm: initialize header data: [hdr=%p, data=%p] (%s)\n", (void *) h, (void *) h->data, id); @@ -1035,7 +1035,7 @@ static const char *get_message_last_filename(notmuch_message_t *msg) static void progress_reset(struct Context *ctx) { - struct NmCtxdata *data = NULL; + struct NmCtxData *data = NULL; if (ctx->quiet) return; @@ -1053,7 +1053,7 @@ static void progress_reset(struct Context *ctx) static void progress_update(struct Context *ctx, notmuch_query_t *q) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (ctx->quiet || !data || data->noprogress) return; @@ -1117,7 +1117,7 @@ static void append_message(struct Context *ctx, notmuch_query_t *q, const char *path = NULL; struct Header *h = NULL; - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (!data) return; @@ -1185,7 +1185,7 @@ static void append_message(struct Context *ctx, notmuch_query_t *q, if (newpath) { /* remember that file has been moved -- nm_sync_mailbox() will update the DB */ - struct NmHdrdata *hd = (struct NmHdrdata *) h->data; + struct NmHdrData *hd = (struct NmHdrData *) h->data; if (hd) { @@ -1231,7 +1231,7 @@ static void append_thread(struct Context *ctx, notmuch_query_t *q, static bool read_mesgs_query(struct Context *ctx, notmuch_query_t *q, int dedup) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); int limit; notmuch_messages_t *msgs = NULL; @@ -1264,7 +1264,7 @@ static bool read_mesgs_query(struct Context *ctx, notmuch_query_t *q, int dedup) static bool read_threads_query(struct Context *ctx, notmuch_query_t *q, int dedup, int limit) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); notmuch_threads_t *threads = NULL; if (!data) @@ -1479,7 +1479,7 @@ static int rename_maildir_filename(const char *old, char *newpath, size_t newsz, return 0; } -static int remove_filename(struct NmCtxdata *data, const char *path) +static int remove_filename(struct NmCtxData *data, const char *path) { notmuch_status_t st; notmuch_filenames_t *ls = NULL; @@ -1533,7 +1533,7 @@ static int remove_filename(struct NmCtxdata *data, const char *path) return 0; } -static int rename_filename(struct NmCtxdata *data, const char *old, +static int rename_filename(struct NmCtxData *data, const char *old, const char *new, struct Header *h) { int rc = -1; @@ -1639,27 +1639,27 @@ static unsigned count_query(notmuch_database_t *db, const char *qstr) char *nm_header_get_folder(struct Header *h) { - return (h && h->data) ? ((struct NmHdrdata *) h->data)->folder : NULL; + return (h && h->data) ? ((struct NmHdrData *) h->data)->folder : NULL; } char *nm_header_get_tags(struct Header *h) { - return (h && h->data) ? ((struct NmHdrdata *) h->data)->tags : NULL; + return (h && h->data) ? ((struct NmHdrData *) h->data)->tags : NULL; } char *nm_header_get_tags_transformed(struct Header *h) { - return (h && h->data) ? ((struct NmHdrdata *) h->data)->tags_transformed : NULL; + return (h && h->data) ? ((struct NmHdrData *) h->data)->tags_transformed : NULL; } char *nm_header_get_tag_transformed(char *tag, struct Header *h) { - struct NmHdrtag *tmp = NULL; + struct NmHdrTag *tmp = NULL; if (!h || !h->data) return NULL; - for (tmp = ((struct NmHdrdata *) h->data)->tag_list; tmp != NULL; tmp = tmp->next) + for (tmp = ((struct NmHdrData *) h->data)->tag_list; tmp != NULL; tmp = tmp->next) { if (strcmp(tag, tmp->tag) == 0) return tmp->transformed; @@ -1670,7 +1670,7 @@ char *nm_header_get_tag_transformed(char *tag, struct Header *h) void nm_longrun_init(struct Context *ctx, int writable) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (data && get_db(data, writable)) { @@ -1681,7 +1681,7 @@ void nm_longrun_init(struct Context *ctx, int writable) void nm_longrun_done(struct Context *ctx) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (data && (release_db(data) == 0)) mutt_debug(2, "nm: long run deinitialized\n"); @@ -1689,7 +1689,7 @@ void nm_longrun_done(struct Context *ctx) void nm_debug_check(struct Context *ctx) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (!data) return; @@ -1702,7 +1702,7 @@ void nm_debug_check(struct Context *ctx) int nm_read_entire_thread(struct Context *ctx, struct Header *h) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); const char *id = NULL; char *qstr = NULL; notmuch_query_t *q = NULL; @@ -1756,7 +1756,7 @@ done: char *nm_uri_from_query(struct Context *ctx, char *buf, size_t bufsz) { mutt_debug(2, "nm_uri_from_query (%s)\n", buf); - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); char uri[_POSIX_PATH_MAX + LONG_STRING + 32]; /* path to DB + query + URI "decoration" */ if (data) @@ -1798,7 +1798,7 @@ bool nm_normalize_uri(char *new_uri, const char *orig_uri, size_t new_uri_sz) char buf[LONG_STRING]; struct Context tmp_ctx; - struct NmCtxdata tmp_ctxdata; + struct NmCtxData tmp_ctxdata; tmp_ctx.magic = MUTT_NOTMUCH; tmp_ctx.data = &tmp_ctxdata; @@ -1870,7 +1870,7 @@ void nm_query_window_backward(void) int nm_modify_message_tags(struct Context *ctx, struct Header *hdr, char *buf) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); notmuch_database_t *db = NULL; notmuch_message_t *msg = NULL; int rc = -1; @@ -1903,7 +1903,7 @@ bool nm_message_is_still_queried(struct Context *ctx, struct Header *hdr) { char *orig_str = NULL; char *new_str = NULL; - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); notmuch_database_t *db = NULL; notmuch_query_t *q = NULL; bool result = false; @@ -1964,7 +1964,7 @@ int nm_update_filename(struct Context *ctx, const char *old, const char *new, { char buf[PATH_MAX]; int rc; - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (!data || !new) return -1; @@ -2099,7 +2099,7 @@ int nm_record_message(struct Context *ctx, char *path, struct Header *h) notmuch_status_t st; notmuch_message_t *msg = NULL; int rc = -1, trans; - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); if (!path || !data || (access(path, F_OK) != 0)) return 0; @@ -2142,7 +2142,7 @@ done: int nm_get_all_tags(struct Context *ctx, char **tag_list, int *tag_count) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); notmuch_database_t *db = NULL; notmuch_tags_t *tags = NULL; const char *tag = NULL; @@ -2186,7 +2186,7 @@ done: static int nm_open_mailbox(struct Context *ctx) { notmuch_query_t *q = NULL; - struct NmCtxdata *data = NULL; + struct NmCtxData *data = NULL; int rc = -1; if (init_context(ctx) != 0) @@ -2253,7 +2253,7 @@ static int nm_close_mailbox(struct Context *ctx) static int nm_check_mailbox(struct Context *ctx, int *index_hint) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); time_t mtime = 0; notmuch_query_t *q = NULL; notmuch_messages_t *msgs = NULL; @@ -2368,7 +2368,7 @@ done: static int nm_sync_mailbox(struct Context *ctx, int *index_hint) { - struct NmCtxdata *data = get_ctxdata(ctx); + struct NmCtxData *data = get_ctxdata(ctx); int rc = 0; char msgbuf[STRING]; struct Progress progress; @@ -2391,7 +2391,7 @@ static int nm_sync_mailbox(struct Context *ctx, int *index_hint) { char old[_POSIX_PATH_MAX], new[_POSIX_PATH_MAX]; struct Header *h = ctx->hdrs[i]; - struct NmHdrdata *hd = h->data; + struct NmHdrData *hd = h->data; if (!ctx->quiet) mutt_progress_update(&progress, i, -1); diff --git a/muttlib.c b/muttlib.c index ff5f9ac4a..8a80faab9 100644 --- a/muttlib.c +++ b/muttlib.c @@ -71,12 +71,12 @@ #endif static const char *xdg_env_vars[] = { - [kXDGConfigHome] = "XDG_CONFIG_HOME", - [kXDGConfigDirs] = "XDG_CONFIG_DIRS", + [XDG_CONFIG_HOME] = "XDG_CONFIG_HOME", + [XDG_CONFIG_DIRS] = "XDG_CONFIG_DIRS", }; static const char *xdg_defaults[] = { - [kXDGConfigHome] = "~/.config", [kXDGConfigDirs] = "/etc/xdg", + [XDG_CONFIG_HOME] = "~/.config", [XDG_CONFIG_DIRS] = "/etc/xdg", }; struct Body *mutt_new_body(void) @@ -953,7 +953,7 @@ void mutt_pretty_mailbox(char *s, size_t buflen) { char *p = s, *q = s; size_t len; - url_scheme_t scheme; + enum UrlScheme scheme; char tmp[PATH_MAX]; scheme = url_check_scheme(s); @@ -1298,7 +1298,7 @@ void mutt_FormatString(char *dest, /* output buffer */ const char *src, /* template string */ format_t *callback, /* callback for processing */ unsigned long data, /* callback data */ - format_flag flags) /* callback flags */ + enum FormatFlag flags) /* callback flags */ { char prefix[SHORT_STRING], buf[LONG_STRING], *cp = NULL, *wptr = dest, ch; char ifstring[SHORT_STRING], elsestring[SHORT_STRING]; @@ -2225,7 +2225,7 @@ void mutt_encode_path(char *dest, size_t dlen, const char *src) * * Return 1 if an entry was found that actually exists on disk and 0 otherwise. */ -int mutt_set_xdg_path(const XDGType type, char *buf, size_t bufsize) +int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize) { char *xdg_env = getenv(xdg_env_vars[type]); char *xdg = (xdg_env && *xdg_env) ? safe_strdup(xdg_env) : diff --git a/mx.c b/mx.c index 893da461e..638d67e62 100644 --- a/mx.c +++ b/mx.c @@ -262,7 +262,7 @@ static void mx_unlink_empty(const char *path) bool mx_is_imap(const char *p) { - url_scheme_t scheme; + enum UrlScheme scheme; if (!p) return false; @@ -282,7 +282,7 @@ bool mx_is_imap(const char *p) #ifdef USE_POP bool mx_is_pop(const char *p) { - url_scheme_t scheme; + enum UrlScheme scheme; if (!p) return false; @@ -298,7 +298,7 @@ bool mx_is_pop(const char *p) #ifdef USE_NNTP bool mx_is_nntp(const char *p) { - url_scheme_t scheme; + enum UrlScheme scheme; if (!p) return false; @@ -314,7 +314,7 @@ bool mx_is_nntp(const char *p) #ifdef USE_NOTMUCH bool mx_is_notmuch(const char *p) { - url_scheme_t scheme; + enum UrlScheme scheme; if (!p) return false; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 9aede2c36..a6a5e8f63 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -86,7 +86,7 @@ struct CryptCache struct CryptCache *next; }; -struct DnArrayS +struct DnArray { char *key; char *value; @@ -94,9 +94,9 @@ struct DnArrayS /* We work based on user IDs, getting from a user ID to the key is check and does not need any memory (gpgme uses reference counting). */ -struct CryptKeyinfo +struct CryptKeyInfo { - struct CryptKeyinfo *next; + struct CryptKeyInfo *next; gpgme_key_t kobj; int idx; /* and the user ID at this index */ const char *uid; /* and for convenience point to this user ID */ @@ -107,7 +107,7 @@ struct CryptKeyinfo struct CryptEntry { size_t num; - struct CryptKeyinfo *key; + struct CryptKeyInfo *key; }; static struct CryptCache *id_defaults = NULL; @@ -165,7 +165,7 @@ static void print_utf8(FILE *fp, const char *buf, size_t len) /* Return the keyID for the key K. Note that this string is valid as long as K is valid */ -static const char *crypt_keyid(struct CryptKeyinfo *k) +static const char *crypt_keyid(struct CryptKeyInfo *k) { const char *s = "????????"; @@ -181,7 +181,7 @@ static const char *crypt_keyid(struct CryptKeyinfo *k) } /* Return the long keyID for the key K. */ -static const char *crypt_long_keyid(struct CryptKeyinfo *k) +static const char *crypt_long_keyid(struct CryptKeyInfo *k) { const char *s = "????????????????"; @@ -194,7 +194,7 @@ static const char *crypt_long_keyid(struct CryptKeyinfo *k) } /* Return the short keyID for the key K. */ -static const char *crypt_short_keyid(struct CryptKeyinfo *k) +static const char *crypt_short_keyid(struct CryptKeyInfo *k) { const char *s = "????????"; @@ -209,7 +209,7 @@ static const char *crypt_short_keyid(struct CryptKeyinfo *k) } /* Return the hexstring fingerprint from the key K. */ -static const char *crypt_fpr(struct CryptKeyinfo *k) +static const char *crypt_fpr(struct CryptKeyInfo *k) { const char *s = ""; @@ -222,7 +222,7 @@ static const char *crypt_fpr(struct CryptKeyinfo *k) /* Returns the fingerprint if available, otherwise * returns the long keyid. */ -static const char *crypt_fpr_or_lkeyid(struct CryptKeyinfo *k) +static const char *crypt_fpr_or_lkeyid(struct CryptKeyInfo *k) { const char *s = "????????????????"; @@ -277,9 +277,9 @@ static char crypt_flags(int flags) } /* Return a copy of KEY. */ -static struct CryptKeyinfo *crypt_copy_key(struct CryptKeyinfo *key) +static struct CryptKeyInfo *crypt_copy_key(struct CryptKeyInfo *key) { - struct CryptKeyinfo *k = NULL; + struct CryptKeyInfo *k = NULL; k = safe_calloc(1, sizeof(*k)); k->kobj = key->kobj; @@ -294,9 +294,9 @@ static struct CryptKeyinfo *crypt_copy_key(struct CryptKeyinfo *key) /* Release all the keys at the address of KEYLIST and set the address to NULL. */ -static void crypt_free_key(struct CryptKeyinfo **keylist) +static void crypt_free_key(struct CryptKeyInfo **keylist) { - struct CryptKeyinfo *k = NULL; + struct CryptKeyInfo *k = NULL; if (!keylist) return; @@ -312,7 +312,7 @@ static void crypt_free_key(struct CryptKeyinfo **keylist) } /* Return true when key K is valid. */ -static bool crypt_key_is_valid(struct CryptKeyinfo *k) +static bool crypt_key_is_valid(struct CryptKeyInfo *k) { if (k->flags & KEYFLAG_CANTUSE) return false; @@ -320,7 +320,7 @@ static bool crypt_key_is_valid(struct CryptKeyinfo *k) } /* Return true when validity of KEY is sufficient. */ -static int crypt_id_is_strong(struct CryptKeyinfo *key) +static int crypt_id_is_strong(struct CryptKeyInfo *key) { unsigned int is_strong = 0; @@ -346,7 +346,7 @@ static int crypt_id_is_strong(struct CryptKeyinfo *key) } /* Return true when the KEY is valid, i.e. not marked as unusable. */ -static int crypt_id_is_valid(struct CryptKeyinfo *key) +static int crypt_id_is_valid(struct CryptKeyInfo *key) { return !(key->flags & KEYFLAG_CANTUSE); } @@ -354,7 +354,7 @@ static int crypt_id_is_valid(struct CryptKeyinfo *key) /* Return a bit vector describing how well the addresses ADDR and U_ADDR match and whether KEY is valid. */ static int crypt_id_matches_addr(struct Address *addr, struct Address *u_addr, - struct CryptKeyinfo *key) + struct CryptKeyInfo *key) { int rv = 0; @@ -2729,11 +2729,11 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s) static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; struct CryptEntry *entry = NULL; - struct CryptKeyinfo *key = NULL; + struct CryptKeyInfo *key = NULL; int kflags = 0; int optional = (flags & MUTT_FORMAT_OPTIONAL); const char *s = NULL; @@ -2927,7 +2927,7 @@ static const char *crypt_entry_fmt(char *dest, size_t destlen, size_t col, int c /* Used by the display function to format a line. */ static void crypt_entry(char *s, size_t l, struct Menu *menu, int num) { - struct CryptKeyinfo **key_table = (struct CryptKeyinfo **) menu->data; + struct CryptKeyInfo **key_table = (struct CryptKeyInfo **) menu->data; struct CryptEntry entry; entry.key = key_table[num]; @@ -2940,8 +2940,8 @@ static void crypt_entry(char *s, size_t l, struct Menu *menu, int num) /* Compare two addresses and the keyid to be used for sorting. */ static int _crypt_compare_address(const void *a, const void *b) { - struct CryptKeyinfo **s = (struct CryptKeyinfo **) a; - struct CryptKeyinfo **t = (struct CryptKeyinfo **) b; + struct CryptKeyInfo **s = (struct CryptKeyInfo **) a; + struct CryptKeyInfo **t = (struct CryptKeyInfo **) b; int r; if ((r = mutt_strcasecmp((*s)->uid, (*t)->uid))) @@ -2959,8 +2959,8 @@ static int crypt_compare_address(const void *a, const void *b) /* Compare two key IDs and the addresses to be used for sorting. */ static int _crypt_compare_keyid(const void *a, const void *b) { - struct CryptKeyinfo **s = (struct CryptKeyinfo **) a; - struct CryptKeyinfo **t = (struct CryptKeyinfo **) b; + struct CryptKeyInfo **s = (struct CryptKeyInfo **) a; + struct CryptKeyInfo **t = (struct CryptKeyInfo **) b; int r; if ((r = mutt_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)))) @@ -2978,8 +2978,8 @@ static int crypt_compare_keyid(const void *a, const void *b) /* Compare 2 creation dates and the addresses. For sorting. */ static int _crypt_compare_date(const void *a, const void *b) { - struct CryptKeyinfo **s = (struct CryptKeyinfo **) a; - struct CryptKeyinfo **t = (struct CryptKeyinfo **) b; + struct CryptKeyInfo **s = (struct CryptKeyInfo **) a; + struct CryptKeyInfo **t = (struct CryptKeyInfo **) b; unsigned long ts = 0, tt = 0; if ((*s)->kobj->subkeys && ((*s)->kobj->subkeys->timestamp > 0)) @@ -3005,8 +3005,8 @@ static int crypt_compare_date(const void *a, const void *b) addresses and the key IDs. For sorting. */ static int _crypt_compare_trust(const void *a, const void *b) { - struct CryptKeyinfo **s = (struct CryptKeyinfo **) a; - struct CryptKeyinfo **t = (struct CryptKeyinfo **) b; + struct CryptKeyInfo **s = (struct CryptKeyInfo **) a; + struct CryptKeyInfo **t = (struct CryptKeyInfo **) b; unsigned long ts = 0, tt = 0; int r; @@ -3047,7 +3047,7 @@ static int crypt_compare_trust(const void *a, const void *b) /* Print the X.500 Distinguished Name part KEY from the array of parts DN to FP. */ -static int print_dn_part(FILE *fp, struct DnArrayS *dn, const char *key) +static int print_dn_part(FILE *fp, struct DnArray *dn, const char *key) { int any = 0; @@ -3065,7 +3065,7 @@ static int print_dn_part(FILE *fp, struct DnArrayS *dn, const char *key) } /* Print all parts of a DN in a standard sequence. */ -static void print_dn_parts(FILE *fp, struct DnArrayS *dn) +static void print_dn_parts(FILE *fp, struct DnArray *dn) { static const char *const stdpart[] = { "CN", "OU", "O", "STREET", "L", "ST", "C", NULL, @@ -3101,7 +3101,7 @@ static void print_dn_parts(FILE *fp, struct DnArrayS *dn) } /* Parse an RDN; this is a helper to parse_dn(). */ -static const char *parse_dn_part(struct DnArrayS *array, const char *string) +static const char *parse_dn_part(struct DnArray *array, const char *string) { const char *s = NULL, *s1 = NULL; size_t n; @@ -3189,9 +3189,9 @@ static const char *parse_dn_part(struct DnArrayS *array, const char *string) /* Parse a DN and return an array-ized one. This is not a validating parser and it does not support any old-stylish syntax; gpgme is expected to return only rfc2253 compatible strings. */ -static struct DnArrayS *parse_dn(const char *string) +static struct DnArray *parse_dn(const char *string) { - struct DnArrayS *array = NULL; + struct DnArray *array = NULL; size_t arrayidx, arraysize; int i; @@ -3206,7 +3206,7 @@ static struct DnArrayS *parse_dn(const char *string) break; /* ready */ if (arrayidx >= arraysize) { /* mutt lacks a real safe_realoc - so we need to copy */ - struct DnArrayS *a2 = NULL; + struct DnArray *a2 = NULL; arraysize += 5; a2 = safe_malloc((arraysize + 1) * sizeof(*array)); @@ -3266,7 +3266,7 @@ static void parse_and_print_user_id(FILE *fp, const char *userid) fputs(_("[Can't display this user ID (invalid encoding)]"), fp); else { - struct DnArrayS *dn = parse_dn(userid); + struct DnArray *dn = parse_dn(userid); if (!dn) fputs(_("[Can't display this user ID (invalid DN)]"), fp); else @@ -3282,13 +3282,14 @@ static void parse_and_print_user_id(FILE *fp, const char *userid) } } -typedef enum { +enum KeyCap +{ KEY_CAP_CAN_ENCRYPT, KEY_CAP_CAN_SIGN, KEY_CAP_CAN_CERTIFY -} key_cap_t; +}; -static unsigned int key_check_cap(gpgme_key_t key, key_cap_t cap) +static unsigned int key_check_cap(gpgme_key_t key, enum KeyCap cap) { gpgme_subkey_t subkey = NULL; unsigned int ret = 0; @@ -3600,7 +3601,7 @@ static void print_key_info(gpgme_key_t key, FILE *fp) } /* Show detailed information about the selected key */ -static void verify_key(struct CryptKeyinfo *key) +static void verify_key(struct CryptKeyInfo *key) { FILE *fp = NULL; char cmd[LONG_STRING], tempfile[_POSIX_PATH_MAX]; @@ -3725,9 +3726,9 @@ static char *list_to_pattern(struct List *list) /* Return a list of keys which are candidates for the selection. Select by looking at the HINTS list. */ -static struct CryptKeyinfo *get_candidates(struct List *hints, unsigned int app, int secret) +static struct CryptKeyInfo *get_candidates(struct List *hints, unsigned int app, int secret) { - struct CryptKeyinfo *db = NULL, *k = NULL, **kend = NULL; + struct CryptKeyInfo *db = NULL, *k = NULL, **kend = NULL; char *pattern = NULL; gpgme_error_t err; gpgme_ctx_t ctx; @@ -3894,17 +3895,17 @@ static struct List *crypt_add_string_to_hints(struct List *hints, const char *st /* Display a menu to select a key from the array KEYS. FORCED_VALID will be set to true on return if the user did override the key's validity. */ -static struct CryptKeyinfo *crypt_select_key(struct CryptKeyinfo *keys, +static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys, struct Address *p, const char *s, unsigned int app, int *forced_valid) { int keymax; - struct CryptKeyinfo **key_table = NULL; + struct CryptKeyInfo **key_table = NULL; struct Menu *menu = NULL; int i; bool done = false; char helpstr[LONG_STRING], buf[LONG_STRING]; - struct CryptKeyinfo *k = NULL; + struct CryptKeyInfo *k = NULL; int (*f)(const void *, const void *); int menu_to_use = 0; bool unusable = false; @@ -3925,7 +3926,7 @@ static struct CryptKeyinfo *crypt_select_key(struct CryptKeyinfo *keys, if (i == keymax) { keymax += 20; - safe_realloc(&key_table, sizeof(struct CryptKeyinfo *) * keymax); + safe_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax); } key_table[i++] = k; @@ -3954,7 +3955,7 @@ static struct CryptKeyinfo *crypt_select_key(struct CryptKeyinfo *keys, f = crypt_compare_trust; break; } - qsort(key_table, i, sizeof(struct CryptKeyinfo *), f); + qsort(key_table, i, sizeof(struct CryptKeyInfo *), f); if (app & APPLICATION_PGP) menu_to_use = MENU_KEY_SELECT_PGP; @@ -4090,7 +4091,7 @@ static struct CryptKeyinfo *crypt_select_key(struct CryptKeyinfo *keys, return k; } -static struct CryptKeyinfo *crypt_getkeybyaddr(struct Address *a, +static struct CryptKeyInfo *crypt_getkeybyaddr(struct Address *a, short abilities, unsigned int app, int *forced_valid, bool oppenc_mode) { @@ -4102,11 +4103,11 @@ static struct CryptKeyinfo *crypt_getkeybyaddr(struct Address *a, int this_key_has_addr_match = false; int match = false; - struct CryptKeyinfo *keys = NULL, *k = NULL; - struct CryptKeyinfo *the_strong_valid_key = NULL; - struct CryptKeyinfo *a_valid_addrmatch_key = NULL; - struct CryptKeyinfo *matches = NULL; - struct CryptKeyinfo **matches_endp = &matches; + struct CryptKeyInfo *keys = NULL, *k = NULL; + struct CryptKeyInfo *the_strong_valid_key = NULL; + struct CryptKeyInfo *a_valid_addrmatch_key = NULL; + struct CryptKeyInfo *matches = NULL; + struct CryptKeyInfo **matches_endp = &matches; *forced_valid = 0; @@ -4166,7 +4167,7 @@ static struct CryptKeyinfo *crypt_getkeybyaddr(struct Address *a, if (match) { - struct CryptKeyinfo *tmp = NULL; + struct CryptKeyInfo *tmp = NULL; *matches_endp = tmp = crypt_copy_key(k); matches_endp = &tmp->next; @@ -4216,14 +4217,14 @@ static struct CryptKeyinfo *crypt_getkeybyaddr(struct Address *a, return k; } -static struct CryptKeyinfo *crypt_getkeybystr(char *p, short abilities, +static struct CryptKeyInfo *crypt_getkeybystr(char *p, short abilities, unsigned int app, int *forced_valid) { struct List *hints = NULL; - struct CryptKeyinfo *keys = NULL; - struct CryptKeyinfo *matches = NULL; - struct CryptKeyinfo **matches_endp = &matches; - struct CryptKeyinfo *k = NULL; + struct CryptKeyInfo *keys = NULL; + struct CryptKeyInfo *matches = NULL; + struct CryptKeyInfo **matches_endp = &matches; + struct CryptKeyInfo *k = NULL; const char *ps = NULL, *pl = NULL, *pfcopy = NULL, *phint = NULL; mutt_message(_("Looking for keys matching \"%s\"..."), p); @@ -4255,7 +4256,7 @@ static struct CryptKeyinfo *crypt_getkeybystr(char *p, short abilities, (ps && (mutt_strcasecmp(ps, crypt_short_keyid(k)) == 0)) || mutt_stristr(k->uid, p)) { - struct CryptKeyinfo *tmp = NULL; + struct CryptKeyInfo *tmp = NULL; mutt_debug(5, "match.\n"); @@ -4286,10 +4287,10 @@ static struct CryptKeyinfo *crypt_getkeybystr(char *p, short abilities, default. ABILITIES describe the required key abilities (sign, encrypt) and APP the type of the requested key; ether S/MIME or PGP. Return a copy of the key or NULL if not found. */ -static struct CryptKeyinfo *crypt_ask_for_key(char *tag, char *whatfor, short abilities, +static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short abilities, unsigned int app, int *forced_valid) { - struct CryptKeyinfo *key = NULL; + struct CryptKeyInfo *key = NULL; char resp[SHORT_STRING]; struct CryptCache *l = NULL; int dummy; @@ -4353,7 +4354,7 @@ static char *find_keys(struct Address *adrlist, unsigned int app, int oppenc_mod size_t keylist_used = 0; struct Address *addr = NULL; struct Address *p = NULL, *q = NULL; - struct CryptKeyinfo *k_info = NULL; + struct CryptKeyInfo *k_info = NULL; const char *fqdn = mutt_fqdn(1); char buf[LONG_STRING]; int forced_valid; @@ -4477,7 +4478,7 @@ char *smime_gpgme_findkeys(struct Address *adrlist, int oppenc_mode) #ifdef HAVE_GPGME_OP_EXPORT_KEYS struct Body *pgp_gpgme_make_key_attachment(char *tempf) { - struct CryptKeyinfo *key = NULL; + struct CryptKeyInfo *key = NULL; gpgme_ctx_t context = NULL; gpgme_key_t export_keys[2]; gpgme_data_t keydata = NULL; @@ -4588,7 +4589,7 @@ void smime_gpgme_init(void) static int gpgme_send_menu(struct Header *msg, int is_smime) { - struct CryptKeyinfo *p = NULL; + struct CryptKeyInfo *p = NULL; char input_signas[SHORT_STRING]; char *prompt = NULL, *letters = NULL, *choices = NULL; int choice; diff --git a/ncrypt/gnupgparse.c b/ncrypt/gnupgparse.c index ee23da58a..e9fee7ccb 100644 --- a/ncrypt/gnupgparse.c +++ b/ncrypt/gnupgparse.c @@ -374,7 +374,7 @@ bail: return NULL; } -struct PgpKeyInfo *pgp_get_candidates(pgp_ring_t keyring, struct List *hints) +struct PgpKeyInfo *pgp_get_candidates(enum PgpRing keyring, struct List *hints) { FILE *fp = NULL; pid_t thepid; diff --git a/ncrypt/gnupgparse.h b/ncrypt/gnupgparse.h index fbb39b6ca..044afabcd 100644 --- a/ncrypt/gnupgparse.h +++ b/ncrypt/gnupgparse.h @@ -22,6 +22,6 @@ struct List; -struct PgpKeyInfo * pgp_get_candidates(pgp_ring_t keyring, struct List *hints); +struct PgpKeyInfo * pgp_get_candidates(enum PgpRing keyring, struct List *hints); #endif /* _NCRYPT_GNUPGPARSE_H */ diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 8a9d16a3b..34b5af78d 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -56,7 +56,7 @@ static const char *_mutt_fmt_pgp_command(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; struct PgpCommandContext *cctx = (struct PgpCommandContext *) data; @@ -310,7 +310,7 @@ pid_t pgp_invoke_verify_key(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpi pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, - pgp_ring_t keyring, struct List *hints) + enum PgpRing keyring, struct List *hints) { char uids[HUGE_STRING]; char tmpuids[HUGE_STRING]; diff --git a/ncrypt/pgpinvoke.h b/ncrypt/pgpinvoke.h index 2103c5e94..cc6597e8e 100644 --- a/ncrypt/pgpinvoke.h +++ b/ncrypt/pgpinvoke.h @@ -46,7 +46,7 @@ pid_t pgp_invoke_export(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, pid_t pgp_invoke_verify_key(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids); pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, pgp_ring_t keyring, struct List *hints); + int pgpoutfd, int pgperrfd, enum PgpRing keyring, struct List *hints); pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *uids, int flags); diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 74f0c3e21..a44f3c881 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -133,7 +133,7 @@ struct PgpEntry static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; struct PgpEntry *entry = NULL; @@ -650,7 +650,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys, return kp; } -struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, pgp_ring_t keyring) +struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring) { struct PgpKeyInfo *key = NULL; char resp[SHORT_STRING]; @@ -800,7 +800,7 @@ static struct PgpKeyInfo **pgp_get_lastp(struct PgpKeyInfo *p) } struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, - pgp_ring_t keyring, int oppenc_mode) + enum PgpRing keyring, int oppenc_mode) { struct Address *r = NULL, *p = NULL; struct List *hints = NULL; @@ -927,7 +927,7 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, return NULL; } -struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, pgp_ring_t keyring) +struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring) { struct List *hints = NULL; struct PgpKeyInfo *keys = NULL; diff --git a/ncrypt/pgpkey.h b/ncrypt/pgpkey.h index 8555d86e9..0ed481388 100644 --- a/ncrypt/pgpkey.h +++ b/ncrypt/pgpkey.h @@ -22,15 +22,15 @@ struct Address; struct Body; struct PgpKeyInfo; -typedef enum pgp_ring { +enum PgpRing { PGP_PUBRING, PGP_SECRING, -} pgp_ring_t; +}; struct Body *pgp_make_key_attachment(char *tempf); -struct PgpKeyInfo * pgp_ask_for_key(char *tag, char *whatfor, short abilities, pgp_ring_t keyring); -struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, short abilities, pgp_ring_t keyring, int oppenc_mode); -struct PgpKeyInfo * pgp_getkeybystr(char *p, short abilities, pgp_ring_t keyring); +struct PgpKeyInfo * pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring); +struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, int oppenc_mode); +struct PgpKeyInfo * pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring); #endif /* _NCRYPT_PGPKEY_H */ diff --git a/ncrypt/pgppacket.h b/ncrypt/pgppacket.h index f71d6155b..4faf5c621 100644 --- a/ncrypt/pgppacket.h +++ b/ncrypt/pgppacket.h @@ -25,7 +25,7 @@ #include -enum packet_tags +enum PacketTags { PT_RES0 = 0, /* reserved */ PT_ESK, /* Encrypted Session Key */ diff --git a/ncrypt/smime.c b/ncrypt/smime.c index a30584dbf..24f7f4ca0 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -149,7 +149,7 @@ static const char *_mutt_fmt_smime_command(char *dest, size_t destlen, size_t co int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; struct SmimeCommandContext *cctx = (struct SmimeCommandContext *) data; diff --git a/newsrc.c b/newsrc.c index b21b52341..5438ae7b3 100644 --- a/newsrc.c +++ b/newsrc.c @@ -124,18 +124,18 @@ void nntp_group_unread_stat(struct NntpData *nntp_data) anum_t first, last; nntp_data->unread = 0; - if (nntp_data->lastMessage == 0 || nntp_data->firstMessage > nntp_data->lastMessage) + if (nntp_data->last_message == 0 || nntp_data->first_message > nntp_data->last_message) return; - nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1; + nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1; for (unsigned int i = 0; i < nntp_data->newsrc_len; i++) { first = nntp_data->newsrc_ent[i].first; - if (first < nntp_data->firstMessage) - first = nntp_data->firstMessage; + if (first < nntp_data->first_message) + first = nntp_data->first_message; last = nntp_data->newsrc_ent[i].last; - if (last > nntp_data->lastMessage) - last = nntp_data->lastMessage; + if (last > nntp_data->last_message) + last = nntp_data->last_message; if (first <= last) nntp_data->unread -= last - first + 1; } @@ -266,8 +266,8 @@ int nntp_newsrc_parse(struct NntpServer *nserv) nntp_data->newsrc_ent[j].last = 0; j++; } - if (nntp_data->lastMessage == 0) - nntp_data->lastMessage = nntp_data->newsrc_ent[j - 1].last; + if (nntp_data->last_message == 0) + nntp_data->last_message = nntp_data->newsrc_ent[j - 1].last; nntp_data->newsrc_len = j; safe_realloc(&nntp_data->newsrc_ent, j * sizeof(struct NewsrcEntry)); nntp_group_unread_stat(nntp_data); @@ -312,7 +312,7 @@ void nntp_newsrc_gen_entries(struct Context *ctx) /* We don't actually check sequential order, since we mark * "missing" entries as read/deleted */ last = NHDR(ctx->hdrs[i])->article_num; - if (last >= nntp_data->firstMessage && !ctx->hdrs[i]->deleted && + if (last >= nntp_data->first_message && !ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read) { if (nntp_data->newsrc_len >= entries) @@ -339,7 +339,7 @@ void nntp_newsrc_gen_entries(struct Context *ctx) } } - if (series && first <= nntp_data->lastLoaded) + if (series && first <= nntp_data->last_loaded) { if (nntp_data->newsrc_len >= entries) { @@ -347,7 +347,7 @@ void nntp_newsrc_gen_entries(struct Context *ctx) safe_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry)); } nntp_data->newsrc_ent[nntp_data->newsrc_len].first = first; - nntp_data->newsrc_ent[nntp_data->newsrc_len].last = nntp_data->lastLoaded; + nntp_data->newsrc_ent[nntp_data->newsrc_len].last = nntp_data->last_loaded; nntp_data->newsrc_len++; } safe_realloc(&nntp_data->newsrc_ent, nntp_data->newsrc_len * sizeof(struct NewsrcEntry)); @@ -538,14 +538,14 @@ int nntp_add_group(char *line, void *data) nntp_data = nntp_data_find(nserv, group); nntp_data->deleted = false; - nntp_data->firstMessage = first; - nntp_data->lastMessage = last; + nntp_data->first_message = first; + nntp_data->last_message = last; nntp_data->allowed = (mod == 'y') || (mod == 'm'); mutt_str_replace(&nntp_data->desc, desc); - if (nntp_data->newsrc_ent || nntp_data->lastCached) + if (nntp_data->newsrc_ent || nntp_data->last_cached) nntp_group_unread_stat(nntp_data); - else if (nntp_data->lastMessage && nntp_data->firstMessage <= nntp_data->lastMessage) - nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1; + else if (nntp_data->last_message && nntp_data->first_message <= nntp_data->last_message) + nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1; else nntp_data->unread = 0; return 0; @@ -610,7 +610,7 @@ int nntp_active_save_cache(struct NntpServer *nserv) safe_realloc(&buf, buflen); } snprintf(buf + off, buflen - off, "%s %d %d %c%s%s\n", nntp_data->group, - nntp_data->lastMessage, nntp_data->firstMessage, + nntp_data->last_message, nntp_data->first_message, nntp_data->allowed ? 'y' : 'n', nntp_data->desc ? " " : "", nntp_data->desc ? nntp_data->desc : ""); off += strlen(buf + off); @@ -666,12 +666,12 @@ void nntp_hcache_update(struct NntpData *nntp_data, header_cache_t *hc) if (sscanf(hdata, ANUM " " ANUM, &first, &last) == 2) { old = true; - nntp_data->lastCached = last; + nntp_data->last_cached = last; /* clean removed headers from cache */ for (current = first; current <= last; current++) { - if (current >= nntp_data->firstMessage && current <= nntp_data->lastMessage) + if (current >= nntp_data->first_message && current <= nntp_data->last_message) continue; snprintf(buf, sizeof(buf), "%d", current); @@ -683,9 +683,9 @@ void nntp_hcache_update(struct NntpData *nntp_data, header_cache_t *hc) } /* store current values of first and last */ - if (!old || nntp_data->firstMessage != first || nntp_data->lastMessage != last) + if (!old || nntp_data->first_message != first || nntp_data->last_message != last) { - snprintf(buf, sizeof(buf), "%u %u", nntp_data->firstMessage, nntp_data->lastMessage); + snprintf(buf, sizeof(buf), "%u %u", nntp_data->first_message, nntp_data->last_message); mutt_debug(2, "nntp_hcache_update: mutt_hcache_store index: %s\n", buf); mutt_hcache_store_raw(hc, "index", 5, buf, strlen(buf)); } @@ -700,7 +700,7 @@ static int nntp_bcache_delete(const char *id, struct BodyCache *bcache, void *da char c; if (!nntp_data || sscanf(id, ANUM "%c", &anum, &c) != 1 || - anum < nntp_data->firstMessage || anum > nntp_data->lastMessage) + anum < nntp_data->first_message || anum > nntp_data->last_message) { if (nntp_data) mutt_debug(2, "nntp_bcache_delete: mutt_bcache_del %s\n", id); @@ -726,7 +726,7 @@ void nntp_delete_group_cache(struct NntpData *nntp_data) nntp_hcache_namer(nntp_data->group, file, sizeof(file)); cache_expand(file, sizeof(file), &nntp_data->nserv->conn->account, file); unlink(file); - nntp_data->lastCached = 0; + nntp_data->last_cached = 0; mutt_debug(2, "nntp_delete_group_cache: %s\n", file); #endif @@ -816,7 +816,7 @@ void nntp_clear_cache(struct NntpServer *nserv) * %u = username */ const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, - const char *elsestring, unsigned long data, format_flag flags) + const char *elsestring, unsigned long data, enum FormatFlag flags) { struct NntpServer *nserv = (struct NntpServer *) data; struct Account *acct = &nserv->conn->account; @@ -1029,13 +1029,13 @@ struct NntpServer *nntp_select_server(char *server, int leave_lock) { if (nntp_data->deleted) { - nntp_data->firstMessage = first; - nntp_data->lastMessage = last; + nntp_data->first_message = first; + nntp_data->last_message = last; } - if (last >= nntp_data->firstMessage && last <= nntp_data->lastMessage) + if (last >= nntp_data->first_message && last <= nntp_data->last_message) { - nntp_data->lastCached = last; - mutt_debug(2, "nntp_select_server: %s lastCached=%u\n", nntp_data->group, last); + nntp_data->last_cached = last; + mutt_debug(2, "nntp_select_server: %s last_cached=%u\n", nntp_data->group, last); } } mutt_hcache_free(hc, &hdata); @@ -1093,7 +1093,7 @@ void nntp_article_status(struct Context *ctx, struct Header *hdr, char *group, a } /* article was not cached yet, it's new */ - if (anum > nntp_data->lastCached) + if (anum > nntp_data->last_cached) return; /* article isn't read but cached, it's old */ @@ -1159,7 +1159,7 @@ struct NntpData *mutt_newsgroup_catchup(struct NntpServer *nserv, char *group) safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry)); nntp_data->newsrc_len = 1; nntp_data->newsrc_ent[0].first = 1; - nntp_data->newsrc_ent[0].last = nntp_data->lastMessage; + nntp_data->newsrc_ent[0].last = nntp_data->last_message; } nntp_data->unread = 0; if (Context && Context->data == nntp_data) @@ -1187,7 +1187,7 @@ struct NntpData *mutt_newsgroup_uncatchup(struct NntpServer *nserv, char *group) safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry)); nntp_data->newsrc_len = 1; nntp_data->newsrc_ent[0].first = 1; - nntp_data->newsrc_ent[0].last = nntp_data->firstMessage - 1; + nntp_data->newsrc_ent[0].last = nntp_data->first_message - 1; } if (Context && Context->data == nntp_data) { @@ -1197,7 +1197,7 @@ struct NntpData *mutt_newsgroup_uncatchup(struct NntpServer *nserv, char *group) } else { - nntp_data->unread = nntp_data->lastMessage; + nntp_data->unread = nntp_data->last_message; if (nntp_data->newsrc_ent) nntp_data->unread -= nntp_data->newsrc_ent[0].last; } diff --git a/nntp.c b/nntp.c index 028052dd1..4c10ad913 100644 --- a/nntp.c +++ b/nntp.c @@ -1150,8 +1150,8 @@ static int parse_overview_line(char *line, void *data) if (!hdr->read) nntp_parse_xref(ctx, hdr); } - if (anum > nntp_data->lastLoaded) - nntp_data->lastLoaded = anum; + if (anum > nntp_data->last_loaded) + nntp_data->last_loaded = anum; } else mutt_free_header(&hdr); @@ -1363,8 +1363,8 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, if (!hdr->read) nntp_parse_xref(ctx, hdr); } - if (current > nntp_data->lastLoaded) - nntp_data->lastLoaded = current; + if (current > nntp_data->last_loaded) + nntp_data->last_loaded = current; first_over = current + 1; } @@ -1476,8 +1476,8 @@ static int nntp_open_mailbox(struct Context *ctx) mutt_sleep(2); return -1; } - nntp_data->firstMessage = first; - nntp_data->lastMessage = last; + nntp_data->first_message = first; + nntp_data->last_message = last; nntp_data->deleted = false; /* get description if empty */ @@ -1500,14 +1500,14 @@ static int nntp_open_mailbox(struct Context *ctx) nntp_data->bcache = mutt_bcache_open(&nserv->conn->account, nntp_data->group); /* strip off extra articles if adding context is greater than $nntp_context */ - first = nntp_data->firstMessage; - if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext) - first = nntp_data->lastMessage - NntpContext + 1; - nntp_data->lastLoaded = first ? first - 1 : 0; - count = nntp_data->firstMessage; - nntp_data->firstMessage = first; + first = nntp_data->first_message; + if (NntpContext && nntp_data->last_message - first + 1 > NntpContext) + first = nntp_data->last_message - NntpContext + 1; + nntp_data->last_loaded = first ? first - 1 : 0; + count = nntp_data->first_message; + nntp_data->first_message = first; nntp_bcache_update(nntp_data); - nntp_data->firstMessage = count; + nntp_data->first_message = count; #ifdef USE_HCACHE hc = nntp_hcache_open(nntp_data); nntp_hcache_update(nntp_data, hc); @@ -1518,13 +1518,13 @@ static int nntp_open_mailbox(struct Context *ctx) mutt_bit_unset(ctx->rights, MUTT_ACL_DELETE); } nntp_newsrc_close(nserv); - rc = nntp_fetch_headers(ctx, hc, first, nntp_data->lastMessage, 0); + rc = nntp_fetch_headers(ctx, hc, first, nntp_data->last_message, 0); #ifdef USE_HCACHE mutt_hcache_close(hc); #endif if (rc < 0) return -1; - nntp_data->lastLoaded = nntp_data->lastMessage; + nntp_data->last_loaded = nntp_data->last_message; nserv->newsrc_modified = false; return 0; } @@ -1743,13 +1743,13 @@ static int nntp_group_poll(struct NntpData *nntp_data, int update_stat) return -1; if (sscanf(buf, "211 " ANUM " " ANUM " " ANUM, &count, &first, &last) != 3) return 0; - if (first == nntp_data->firstMessage && last == nntp_data->lastMessage) + if (first == nntp_data->first_message && last == nntp_data->last_message) return 0; /* articles have been renumbered */ - if (last < nntp_data->lastMessage) + if (last < nntp_data->last_message) { - nntp_data->lastCached = 0; + nntp_data->last_cached = 0; if (nntp_data->newsrc_len) { safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry)); @@ -1758,13 +1758,13 @@ static int nntp_group_poll(struct NntpData *nntp_data, int update_stat) nntp_data->newsrc_ent[0].last = 0; } } - nntp_data->firstMessage = first; - nntp_data->lastMessage = last; + nntp_data->first_message = first; + nntp_data->last_message = last; if (!update_stat) return 1; /* update counters */ - else if (!last || (!nntp_data->newsrc_ent && !nntp_data->lastCached)) + else if (!last || (!nntp_data->newsrc_ent && !nntp_data->last_cached)) nntp_data->unread = count; else nntp_group_unread_stat(nntp_data); @@ -1803,18 +1803,18 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) nntp_active_save_cache(nserv); /* articles have been renumbered, remove all headers */ - if (nntp_data->lastMessage < nntp_data->lastLoaded) + if (nntp_data->last_message < nntp_data->last_loaded) { for (i = 0; i < ctx->msgcount; i++) mutt_free_header(&ctx->hdrs[i]); ctx->msgcount = 0; ctx->tagged = 0; - if (nntp_data->lastMessage < nntp_data->lastLoaded) + if (nntp_data->last_message < nntp_data->last_loaded) { - nntp_data->lastLoaded = nntp_data->firstMessage - 1; - if (NntpContext && nntp_data->lastMessage - nntp_data->lastLoaded > NntpContext) - nntp_data->lastLoaded = nntp_data->lastMessage - NntpContext; + nntp_data->last_loaded = nntp_data->first_message - 1; + if (NntpContext && nntp_data->last_message - nntp_data->last_loaded > NntpContext) + nntp_data->last_loaded = nntp_data->last_message - NntpContext; } ret = MUTT_REOPENED; } @@ -1828,11 +1828,11 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) char buf[16]; void *hdata = NULL; struct Header *hdr = NULL; - anum_t first = nntp_data->firstMessage; + anum_t first = nntp_data->first_message; - if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext) - first = nntp_data->lastMessage - NntpContext + 1; - messages = safe_calloc(nntp_data->lastLoaded - first + 1, sizeof(unsigned char)); + if (NntpContext && nntp_data->last_message - first + 1 > NntpContext) + first = nntp_data->last_message - NntpContext + 1; + messages = safe_calloc(nntp_data->last_loaded - first + 1, sizeof(unsigned char)); hc = nntp_hcache_open(nntp_data); nntp_hcache_update(nntp_data, hc); #endif @@ -1847,7 +1847,7 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) /* check hcache for flagged and deleted flags */ if (hc) { - if (anum >= first && anum <= nntp_data->lastLoaded) + if (anum >= first && anum <= nntp_data->last_loaded) messages[anum - first] = 1; snprintf(buf, sizeof(buf), "%d", anum); @@ -1891,7 +1891,7 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) ctx->msgcount = j; /* restore headers without "deleted" flag */ - for (anum = first; anum <= nntp_data->lastLoaded; anum++) + for (anum = first; anum <= nntp_data->last_loaded; anum++) { if (messages[anum - first]) continue; @@ -1956,7 +1956,7 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) } /* fetch headers of new articles */ - if (nntp_data->lastMessage > nntp_data->lastLoaded) + if (nntp_data->last_message > nntp_data->last_loaded) { int oldmsgcount = ctx->msgcount; bool quiet = ctx->quiet; @@ -1968,10 +1968,10 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) nntp_hcache_update(nntp_data, hc); } #endif - rc = nntp_fetch_headers(ctx, hc, nntp_data->lastLoaded + 1, nntp_data->lastMessage, 0); + rc = nntp_fetch_headers(ctx, hc, nntp_data->last_loaded + 1, nntp_data->last_message, 0); ctx->quiet = quiet; if (rc >= 0) - nntp_data->lastLoaded = nntp_data->lastMessage; + nntp_data->last_loaded = nntp_data->last_message; if (ret == 0 && ctx->msgcount > oldmsgcount) ret = MUTT_NEW_MAIL; } @@ -2002,7 +2002,7 @@ static int nntp_sync_mailbox(struct Context *ctx, int *index_hint) return rc; #ifdef USE_HCACHE - nntp_data->lastCached = 0; + nntp_data->last_cached = 0; hc = nntp_hcache_open(nntp_data); #endif @@ -2034,7 +2034,7 @@ static int nntp_sync_mailbox(struct Context *ctx, int *index_hint) if (hc) { mutt_hcache_close(hc); - nntp_data->lastCached = nntp_data->lastLoaded; + nntp_data->last_cached = nntp_data->last_loaded; } #endif @@ -2356,7 +2356,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid) if (!nntp_data || !nntp_data->nserv) return -1; - if (nntp_data->firstMessage > nntp_data->lastLoaded) + if (nntp_data->first_message > nntp_data->last_loaded) return 0; /* init context */ @@ -2367,7 +2367,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid) /* fetch numbers of child messages */ snprintf(buf, sizeof(buf), "XPAT References %d-%d *%s*\r\n", - nntp_data->firstMessage, nntp_data->lastLoaded, msgid); + nntp_data->first_message, nntp_data->last_loaded, msgid); rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_children, &cc); if (rc) { diff --git a/nntp.h b/nntp.h index b23d28432..9627ea2cf 100644 --- a/nntp.h +++ b/nntp.h @@ -99,10 +99,10 @@ struct NntpData { char *group; char *desc; - anum_t firstMessage; - anum_t lastMessage; - anum_t lastLoaded; - anum_t lastCached; + anum_t first_message; + anum_t last_message; + anum_t last_loaded; + anum_t last_cached; anum_t unread; bool subscribed : 1; bool new : 1; @@ -155,7 +155,7 @@ void nntp_clear_cache(struct NntpServer *nserv); const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags); + unsigned long data, enum FormatFlag flags); struct NntpServer *CurrentNewsSrv INITVAL(NULL); diff --git a/pager.c b/pager.c index 87b60063f..210ce62d7 100644 --- a/pager.c +++ b/pager.c @@ -160,8 +160,8 @@ static short InHelp = 0; static struct Resize { int line; - int SearchCompiled; - int SearchBack; + int search_compiled; + int search_back; } *Resize = NULL; #endif @@ -198,7 +198,7 @@ static int check_sig(const char *s, struct Line *info, int n) return 0; } -static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, +static void resolve_color(struct Line *line_info, int n, int cnt, int flags, int special, struct AnsiAttr *a) { int def_color; /* color without syntax highlight */ @@ -210,7 +210,7 @@ static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, if (!cnt) last_color = -1; /* force attrset() */ - if (lineInfo[n].continuation) + if (line_info[n].continuation) { if (!cnt && option(OPTMARKERS)) { @@ -218,21 +218,21 @@ static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, addch('+'); last_color = ColorDefs[MT_COLOR_MARKERS]; } - m = (lineInfo[n].syntax)[0].first; - cnt += (lineInfo[n].syntax)[0].last; + m = (line_info[n].syntax)[0].first; + cnt += (line_info[n].syntax)[0].last; } else m = n; if (!(flags & MUTT_SHOWCOLOR)) def_color = ColorDefs[MT_COLOR_NORMAL]; - else if (lineInfo[m].type == MT_COLOR_HEADER) - def_color = (lineInfo[m].syntax)[0].color; + else if (line_info[m].type == MT_COLOR_HEADER) + def_color = (line_info[m].syntax)[0].color; else - def_color = ColorDefs[lineInfo[m].type]; + def_color = ColorDefs[line_info[m].type]; - if ((flags & MUTT_SHOWCOLOR) && lineInfo[m].type == MT_COLOR_QUOTED) + if ((flags & MUTT_SHOWCOLOR) && line_info[m].type == MT_COLOR_QUOTED) { - struct QClass *class = lineInfo[m].quote; + struct QClass *class = line_info[m].quote; if (class) { @@ -249,16 +249,16 @@ static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, color = def_color; if (flags & MUTT_SHOWCOLOR) { - for (i = 0; i < lineInfo[m].chunks; i++) + for (i = 0; i < line_info[m].chunks; i++) { /* we assume the chunks are sorted */ - if (cnt > (lineInfo[m].syntax)[i].last) + if (cnt > (line_info[m].syntax)[i].last) continue; - if (cnt < (lineInfo[m].syntax)[i].first) + if (cnt < (line_info[m].syntax)[i].first) break; - if (cnt != (lineInfo[m].syntax)[i].last) + if (cnt != (line_info[m].syntax)[i].last) { - color = (lineInfo[m].syntax)[i].color; + color = (line_info[m].syntax)[i].color; break; } /* don't break here, as cnt might be @@ -268,13 +268,13 @@ static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, if (flags & MUTT_SEARCH) { - for (i = 0; i < lineInfo[m].search_cnt; i++) + for (i = 0; i < line_info[m].search_cnt; i++) { - if (cnt > (lineInfo[m].search)[i].last) + if (cnt > (line_info[m].search)[i].last) continue; - if (cnt < (lineInfo[m].search)[i].first) + if (cnt < (line_info[m].search)[i].first) break; - if (cnt != (lineInfo[m].search)[i].last) + if (cnt != (line_info[m].search)[i].last) { color = ColorDefs[MT_COLOR_SEARCH]; search = true; @@ -332,22 +332,22 @@ static void resolve_color(struct Line *lineInfo, int n, int cnt, int flags, } } -static void append_line(struct Line *lineInfo, int n, int cnt) +static void append_line(struct Line *line_info, int n, int cnt) { int m; - lineInfo[n + 1].type = lineInfo[n].type; - (lineInfo[n + 1].syntax)[0].color = (lineInfo[n].syntax)[0].color; - lineInfo[n + 1].continuation = 1; + line_info[n + 1].type = line_info[n].type; + (line_info[n + 1].syntax)[0].color = (line_info[n].syntax)[0].color; + line_info[n + 1].continuation = 1; /* find the real start of the line */ for (m = n; m >= 0; m--) - if (lineInfo[m].continuation == 0) + if (line_info[m].continuation == 0) break; - (lineInfo[n + 1].syntax)[0].first = m; - (lineInfo[n + 1].syntax)[0].last = - (lineInfo[n].continuation) ? cnt + (lineInfo[n].syntax)[0].last : cnt; + (line_info[n + 1].syntax)[0].first = m; + (line_info[n + 1].syntax)[0].last = + (line_info[n].continuation) ? cnt + (line_info[n].syntax)[0].last : cnt; } static void new_class_color(struct QClass *class, int *q_level) @@ -356,12 +356,12 @@ static void new_class_color(struct QClass *class, int *q_level) class->color = ColorQuote[class->index % ColorQuoteUsed]; } -static void shift_class_colors(struct QClass *QuoteList, +static void shift_class_colors(struct QClass *quote_list, struct QClass *new_class, int index, int *q_level) { struct QClass *q_list = NULL; - q_list = QuoteList; + q_list = quote_list; new_class->index = -1; while (q_list) @@ -393,28 +393,28 @@ static void shift_class_colors(struct QClass *QuoteList, (*q_level)++; } -static void cleanup_quote(struct QClass **QuoteList) +static void cleanup_quote(struct QClass **quote_list) { struct QClass *ptr = NULL; - while (*QuoteList) + while (*quote_list) { - if ((*QuoteList)->down) - cleanup_quote(&((*QuoteList)->down)); - ptr = (*QuoteList)->next; - if ((*QuoteList)->prefix) - FREE(&(*QuoteList)->prefix); - FREE(QuoteList); - *QuoteList = ptr; + if ((*quote_list)->down) + cleanup_quote(&((*quote_list)->down)); + ptr = (*quote_list)->next; + if ((*quote_list)->prefix) + FREE(&(*quote_list)->prefix); + FREE(quote_list); + *quote_list = ptr; } return; } -static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr, +static struct QClass *classify_quote(struct QClass **quote_list, const char *qptr, int length, int *force_redraw, int *q_level) { - struct QClass *q_list = *QuoteList; + struct QClass *q_list = *quote_list; struct QClass *class = NULL, *tmp = NULL, *ptr = NULL, *save = NULL; char *tail_qptr = NULL; int offset, tail_lng; @@ -424,13 +424,13 @@ static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr { /* not much point in classifying quotes... */ - if (*QuoteList == NULL) + if (*quote_list == NULL) { class = safe_calloc(1, sizeof(struct QClass)); class->color = ColorQuote[0]; - *QuoteList = class; + *quote_list = class; } - return *QuoteList; + return *quote_list; } /* Did I mention how much I like emulating Lisp in C? */ @@ -477,8 +477,8 @@ static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr q_list->prev = NULL; /* update the root if necessary */ - if (q_list == *QuoteList) - *QuoteList = tmp; + if (q_list == *quote_list) + *quote_list = tmp; index = q_list->index; @@ -683,7 +683,7 @@ static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr else { if (index != -1) - shift_class_colors(*QuoteList, tmp, index, q_level); + shift_class_colors(*quote_list, tmp, index, q_level); return class; } @@ -706,16 +706,16 @@ static struct QClass *classify_quote(struct QClass **QuoteList, const char *qptr class->length = length; new_class_color(class, q_level); - if (*QuoteList) + if (*quote_list) { - class->next = *QuoteList; - (*QuoteList)->prev = class; + class->next = *quote_list; + (*quote_list)->prev = class; } - *QuoteList = class; + *quote_list = class; } if (index != -1) - shift_class_colors(*QuoteList, tmp, index, q_level); + shift_class_colors(*quote_list, tmp, index, q_level); return class; } @@ -732,8 +732,8 @@ static int check_attachment_marker(char *p) return (int) (*p - *q); } -static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, - int last, struct QClass **QuoteList, int *q_level, +static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, + int last, struct QClass **quote_list, int *q_level, int *force_redraw, int q_classify) { struct ColorLine *color_line = NULL; @@ -742,11 +742,11 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, bool null_rx; int offset, i; - if (n == 0 || ISHEADER(lineInfo[n - 1].type)) + if (n == 0 || ISHEADER(line_info[n - 1].type)) { if (buf[0] == '\n') /* end of header */ { - lineInfo[n].type = MT_COLOR_NORMAL; + line_info[n].type = MT_COLOR_NORMAL; getyx(stdscr, brailleLine, brailleCol); } else @@ -755,16 +755,16 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, * line's color as default. */ if (n > 0 && (buf[0] == ' ' || buf[0] == '\t')) { - lineInfo[n].type = lineInfo[n - 1].type; /* wrapped line */ + line_info[n].type = line_info[n - 1].type; /* wrapped line */ if (!option(OPTHEADERCOLORPARTIAL)) { - (lineInfo[n].syntax)[0].color = (lineInfo[n - 1].syntax)[0].color; - lineInfo[n].is_cont_hdr = 1; + (line_info[n].syntax)[0].color = (line_info[n - 1].syntax)[0].color; + line_info[n].is_cont_hdr = 1; } } else { - lineInfo[n].type = MT_COLOR_HDEFAULT; + line_info[n].type = MT_COLOR_HDEFAULT; } /* When this option is unset, we color the entire header the @@ -777,22 +777,22 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, { if (REGEXEC(color_line->rx, buf) == 0) { - lineInfo[n].type = MT_COLOR_HEADER; - lineInfo[n].syntax[0].color = color_line->pair; - if (lineInfo[n].is_cont_hdr) + line_info[n].type = MT_COLOR_HEADER; + line_info[n].syntax[0].color = color_line->pair; + if (line_info[n].is_cont_hdr) { /* adjust the previous continuation lines to reflect the color of this continuation line */ int j; - for (j = n - 1; j >= 0 && lineInfo[j].is_cont_hdr; --j) + for (j = n - 1; j >= 0 && line_info[j].is_cont_hdr; --j) { - lineInfo[j].type = lineInfo[n].type; - lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color; + line_info[j].type = line_info[n].type; + line_info[j].syntax[0].color = line_info[n].syntax[0].color; } /* now adjust the first line of this header field */ if (j >= 0) { - lineInfo[j].type = lineInfo[n].type; - lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color; + line_info[j].type = line_info[n].type; + line_info[j].syntax[0].color = line_info[n].syntax[0].color; } *force_redraw = 1; /* the previous lines have already been drawn on the screen */ } @@ -803,29 +803,29 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, } } else if (mutt_strncmp("\033[0m", raw, 4) == 0) /* a little hack... */ - lineInfo[n].type = MT_COLOR_NORMAL; + line_info[n].type = MT_COLOR_NORMAL; else if (check_attachment_marker((char *) raw) == 0) - lineInfo[n].type = MT_COLOR_ATTACHMENT; + line_info[n].type = MT_COLOR_ATTACHMENT; else if ((mutt_strcmp("-- \n", buf) == 0) || (mutt_strcmp("-- \r\n", buf) == 0)) { i = n + 1; - lineInfo[n].type = MT_COLOR_SIGNATURE; - while (i < last && check_sig(buf, lineInfo, i - 1) == 0 && - (lineInfo[i].type == MT_COLOR_NORMAL || lineInfo[i].type == MT_COLOR_QUOTED || - lineInfo[i].type == MT_COLOR_HEADER)) + line_info[n].type = MT_COLOR_SIGNATURE; + while (i < last && check_sig(buf, line_info, i - 1) == 0 && + (line_info[i].type == MT_COLOR_NORMAL || line_info[i].type == MT_COLOR_QUOTED || + line_info[i].type == MT_COLOR_HEADER)) { /* oops... */ - if (lineInfo[i].chunks) + if (line_info[i].chunks) { - lineInfo[i].chunks = 0; - safe_realloc(&(lineInfo[n].syntax), sizeof(struct Syntax)); + line_info[i].chunks = 0; + safe_realloc(&(line_info[n].syntax), sizeof(struct Syntax)); } - lineInfo[i++].type = MT_COLOR_SIGNATURE; + line_info[i++].type = MT_COLOR_SIGNATURE; } } - else if (check_sig(buf, lineInfo, n - 1) == 0) - lineInfo[n].type = MT_COLOR_SIGNATURE; + else if (check_sig(buf, line_info, n - 1) == 0) + line_info[n].type = MT_COLOR_SIGNATURE; else if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0) { if (regexec((regex_t *) Smileys.rx, buf, 1, smatch, 0) == 0) @@ -840,35 +840,35 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0) { - if (q_classify && lineInfo[n].quote == NULL) - lineInfo[n].quote = classify_quote(QuoteList, buf + pmatch[0].rm_so, + if (q_classify && line_info[n].quote == NULL) + line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so, pmatch[0].rm_eo - pmatch[0].rm_so, force_redraw, q_level); - lineInfo[n].type = MT_COLOR_QUOTED; + line_info[n].type = MT_COLOR_QUOTED; } else - lineInfo[n].type = MT_COLOR_NORMAL; + line_info[n].type = MT_COLOR_NORMAL; buf[smatch[0].rm_so] = c; } else - lineInfo[n].type = MT_COLOR_NORMAL; + line_info[n].type = MT_COLOR_NORMAL; } else { - if (q_classify && lineInfo[n].quote == NULL) - lineInfo[n].quote = classify_quote(QuoteList, buf + pmatch[0].rm_so, + if (q_classify && line_info[n].quote == NULL) + line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so, pmatch[0].rm_eo - pmatch[0].rm_so, force_redraw, q_level); - lineInfo[n].type = MT_COLOR_QUOTED; + line_info[n].type = MT_COLOR_QUOTED; } } else - lineInfo[n].type = MT_COLOR_NORMAL; + line_info[n].type = MT_COLOR_NORMAL; /* body patterns */ - if (lineInfo[n].type == MT_COLOR_NORMAL || lineInfo[n].type == MT_COLOR_QUOTED || - (lineInfo[n].type == MT_COLOR_HDEFAULT && option(OPTHEADERCOLORPARTIAL))) + if (line_info[n].type == MT_COLOR_NORMAL || line_info[n].type == MT_COLOR_QUOTED || + (line_info[n].type == MT_COLOR_HDEFAULT && option(OPTHEADERCOLORPARTIAL))) { size_t nl; @@ -879,7 +879,7 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, i = 0; offset = 0; - lineInfo[n].chunks = 0; + line_info[n].chunks = 0; do { if (!buf[offset]) @@ -887,7 +887,7 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, found = false; null_rx = false; - if (lineInfo[n].type == MT_COLOR_HDEFAULT) + if (line_info[n].type == MT_COLOR_HDEFAULT) color_line = ColorHdrList; else color_line = ColorBodyList; @@ -901,25 +901,25 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, { /* Abort if we fill up chunks. * Yes, this really happened. See #3888 */ - if (lineInfo[n].chunks == SHRT_MAX) + if (line_info[n].chunks == SHRT_MAX) { null_rx = false; break; } - if (++(lineInfo[n].chunks) > 1) - safe_realloc(&(lineInfo[n].syntax), - (lineInfo[n].chunks) * sizeof(struct Syntax)); + if (++(line_info[n].chunks) > 1) + safe_realloc(&(line_info[n].syntax), + (line_info[n].chunks) * sizeof(struct Syntax)); } - i = lineInfo[n].chunks - 1; + i = line_info[n].chunks - 1; pmatch[0].rm_so += offset; pmatch[0].rm_eo += offset; - if (!found || pmatch[0].rm_so < (lineInfo[n].syntax)[i].first || - (pmatch[0].rm_so == (lineInfo[n].syntax)[i].first && - pmatch[0].rm_eo > (lineInfo[n].syntax)[i].last)) + if (!found || pmatch[0].rm_so < (line_info[n].syntax)[i].first || + (pmatch[0].rm_so == (line_info[n].syntax)[i].first && + pmatch[0].rm_eo > (line_info[n].syntax)[i].last)) { - (lineInfo[n].syntax)[i].color = color_line->pair; - (lineInfo[n].syntax)[i].first = pmatch[0].rm_so; - (lineInfo[n].syntax)[i].last = pmatch[0].rm_eo; + (line_info[n].syntax)[i].color = color_line->pair; + (line_info[n].syntax)[i].first = pmatch[0].rm_so; + (line_info[n].syntax)[i].last = pmatch[0].rm_eo; } found = true; null_rx = false; @@ -933,14 +933,14 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, if (null_rx) offset++; /* avoid degenerate cases */ else - offset = (lineInfo[n].syntax)[i].last; + offset = (line_info[n].syntax)[i].last; } while (found || null_rx); if (nl > 0) buf[nl] = '\n'; } /* attachment patterns */ - if (lineInfo[n].type == MT_COLOR_ATTACHMENT) + if (line_info[n].type == MT_COLOR_ATTACHMENT) { size_t nl; @@ -951,7 +951,7 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, i = 0; offset = 0; - lineInfo[n].chunks = 0; + line_info[n].chunks = 0; do { if (!buf[offset]) @@ -967,20 +967,20 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, { if (!found) { - if (++(lineInfo[n].chunks) > 1) - safe_realloc(&(lineInfo[n].syntax), - (lineInfo[n].chunks) * sizeof(struct Syntax)); + if (++(line_info[n].chunks) > 1) + safe_realloc(&(line_info[n].syntax), + (line_info[n].chunks) * sizeof(struct Syntax)); } - i = lineInfo[n].chunks - 1; + i = line_info[n].chunks - 1; pmatch[0].rm_so += offset; pmatch[0].rm_eo += offset; - if (!found || pmatch[0].rm_so < (lineInfo[n].syntax)[i].first || - (pmatch[0].rm_so == (lineInfo[n].syntax)[i].first && - pmatch[0].rm_eo > (lineInfo[n].syntax)[i].last)) + if (!found || pmatch[0].rm_so < (line_info[n].syntax)[i].first || + (pmatch[0].rm_so == (line_info[n].syntax)[i].first && + pmatch[0].rm_eo > (line_info[n].syntax)[i].last)) { - (lineInfo[n].syntax)[i].color = color_line->pair; - (lineInfo[n].syntax)[i].first = pmatch[0].rm_so; - (lineInfo[n].syntax)[i].last = pmatch[0].rm_eo; + (line_info[n].syntax)[i].color = color_line->pair; + (line_info[n].syntax)[i].first = pmatch[0].rm_so; + (line_info[n].syntax)[i].last = pmatch[0].rm_eo; } found = 1; null_rx = 0; @@ -993,7 +993,7 @@ static void resolve_types(char *buf, char *raw, struct Line *lineInfo, int n, if (null_rx) offset++; /* avoid degenerate cases */ else - offset = (lineInfo[n].syntax)[i].last; + offset = (line_info[n].syntax)[i].last; } while (found || null_rx); if (nl > 0) buf[nl] = '\n'; @@ -1179,12 +1179,12 @@ static int fill_buffer(FILE *f, LOFF_T *last_pos, LOFF_T offset, unsigned char * return b_read; } -static int format_line(struct Line **lineInfo, int n, unsigned char *buf, int flags, +static int format_line(struct Line **line_info, int n, unsigned char *buf, int flags, struct AnsiAttr *pa, int cnt, int *pspace, int *pvch, int *pcol, int *pspecial, struct MuttWindow *pager_window) { int space = -1; /* index of the last space or TAB */ - int col = option(OPTMARKERS) ? (*lineInfo)[n].continuation : 0; + int col = option(OPTMARKERS) ? (*line_info)[n].continuation : 0; size_t k; int ch, vch, last_special = -1, special = 0, t; wchar_t wc; @@ -1195,7 +1195,7 @@ static int format_line(struct Line **lineInfo, int n, unsigned char *buf, int fl if (check_attachment_marker((char *) buf) == 0) wrap_cols = pager_window->cols; - /* FIXME: this should come from lineInfo */ + /* FIXME: this should come from line_info */ memset(&mbstate, 0, sizeof(mbstate)); for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) @@ -1289,7 +1289,7 @@ static int format_line(struct Line **lineInfo, int n, unsigned char *buf, int fl if (pa && ((flags & (MUTT_SHOWCOLOR | MUTT_SEARCH | MUTT_PAGER_MARKER)) || special || last_special || pa->attr)) { - resolve_color(*lineInfo, n, vch, flags, special, pa); + resolve_color(*line_info, n, vch, flags, special, pa); last_special = special; } @@ -1373,9 +1373,9 @@ static int format_line(struct Line **lineInfo, int n, unsigned char *buf, int fl * 0 normal exit, line was not displayed * >0 normal exit, line was displayed */ -static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n, - int *last, int *max, int flags, struct QClass **QuoteList, - int *q_level, int *force_redraw, regex_t *SearchRE, +static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info, int n, + int *last, int *max, int flags, struct QClass **quote_list, + int *q_level, int *force_redraw, regex_t *search_re, struct MuttWindow *pager_window) { unsigned char *buf = NULL, *fmt = NULL; @@ -1400,53 +1400,53 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n if (*last == *max) { - safe_realloc(lineInfo, sizeof(struct Line) * (*max += LINES)); + safe_realloc(line_info, sizeof(struct Line) * (*max += LINES)); for (ch = *last; ch < *max; ch++) { - memset(&((*lineInfo)[ch]), 0, sizeof(struct Line)); - (*lineInfo)[ch].type = -1; - (*lineInfo)[ch].search_cnt = -1; - (*lineInfo)[ch].syntax = safe_malloc(sizeof(struct Syntax)); - ((*lineInfo)[ch].syntax)[0].first = ((*lineInfo)[ch].syntax)[0].last = -1; + memset(&((*line_info)[ch]), 0, sizeof(struct Line)); + (*line_info)[ch].type = -1; + (*line_info)[ch].search_cnt = -1; + (*line_info)[ch].syntax = safe_malloc(sizeof(struct Syntax)); + ((*line_info)[ch].syntax)[0].first = ((*line_info)[ch].syntax)[0].last = -1; } } /* only do color highlighting if we are viewing a message */ if (flags & (MUTT_SHOWCOLOR | MUTT_TYPES)) { - if ((*lineInfo)[n].type == -1) + if ((*line_info)[n].type == -1) { /* determine the line class */ - if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) + if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) { if (change_last) (*last)--; goto out; } - resolve_types((char *) fmt, (char *) buf, *lineInfo, n, *last, QuoteList, + resolve_types((char *) fmt, (char *) buf, *line_info, n, *last, quote_list, q_level, force_redraw, flags & MUTT_SHOWCOLOR); /* avoid race condition for continuation lines when scrolling up */ - for (m = n + 1; m < *last && (*lineInfo)[m].offset && (*lineInfo)[m].continuation; m++) - (*lineInfo)[m].type = (*lineInfo)[n].type; + for (m = n + 1; m < *last && (*line_info)[m].offset && (*line_info)[m].continuation; m++) + (*line_info)[m].type = (*line_info)[n].type; } /* this also prevents searching through the hidden lines */ - if ((flags & MUTT_HIDE) && (*lineInfo)[n].type == MT_COLOR_QUOTED) + if ((flags & MUTT_HIDE) && (*line_info)[n].type == MT_COLOR_QUOTED) flags = 0; /* MUTT_NOSHOW */ } - /* At this point, (*lineInfo[n]).quote may still be undefined. We + /* At this point, (*line_info[n]).quote may still be undefined. We * don't want to compute it every time MUTT_TYPES is set, since this * would slow down the "bottom" function unacceptably. A compromise * solution is hence to call regexec() again, just to find out the * length of the quote prefix. */ - if ((flags & MUTT_SHOWCOLOR) && !(*lineInfo)[n].continuation && - (*lineInfo)[n].type == MT_COLOR_QUOTED && (*lineInfo)[n].quote == NULL) + if ((flags & MUTT_SHOWCOLOR) && !(*line_info)[n].continuation && + (*line_info)[n].type == MT_COLOR_QUOTED && (*line_info)[n].quote == NULL) { - if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) + if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) { if (change_last) (*last)--; @@ -1454,15 +1454,15 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n } if (regexec((regex_t *) QuoteRegexp.rx, (char *) fmt, 1, pmatch, 0) != 0) goto out; - (*lineInfo)[n].quote = - classify_quote(QuoteList, (char *) fmt + pmatch[0].rm_so, + (*line_info)[n].quote = + classify_quote(quote_list, (char *) fmt + pmatch[0].rm_so, pmatch[0].rm_eo - pmatch[0].rm_so, force_redraw, q_level); } - if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation && - (*lineInfo)[n].search_cnt == -1) + if ((flags & MUTT_SEARCH) && !(*line_info)[n].continuation && + (*line_info)[n].search_cnt == -1) { - if (fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) + if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) { if (change_last) (*last)--; @@ -1470,18 +1470,18 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n } offset = 0; - (*lineInfo)[n].search_cnt = 0; - while (regexec(SearchRE, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) + (*line_info)[n].search_cnt = 0; + while (regexec(search_re, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) { - if (++((*lineInfo)[n].search_cnt) > 1) - safe_realloc(&((*lineInfo)[n].search), - ((*lineInfo)[n].search_cnt) * sizeof(struct Syntax)); + if (++((*line_info)[n].search_cnt) > 1) + safe_realloc(&((*line_info)[n].search), + ((*line_info)[n].search_cnt) * sizeof(struct Syntax)); else - (*lineInfo)[n].search = safe_malloc(sizeof(struct Syntax)); + (*line_info)[n].search = safe_malloc(sizeof(struct Syntax)); pmatch[0].rm_so += offset; pmatch[0].rm_eo += offset; - ((*lineInfo)[n].search)[(*lineInfo)[n].search_cnt - 1].first = pmatch[0].rm_so; - ((*lineInfo)[n].search)[(*lineInfo)[n].search_cnt - 1].last = pmatch[0].rm_eo; + ((*line_info)[n].search)[(*line_info)[n].search_cnt - 1].first = pmatch[0].rm_so; + ((*line_info)[n].search)[(*line_info)[n].search_cnt - 1].last = pmatch[0].rm_eo; if (pmatch[0].rm_eo == pmatch[0].rm_so) offset++; /* avoid degenerate cases */ @@ -1492,20 +1492,20 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n } } - if (!(flags & MUTT_SHOW) && (*lineInfo)[n + 1].offset > 0) + if (!(flags & MUTT_SHOW) && (*line_info)[n + 1].offset > 0) { /* we've already scanned this line, so just exit */ rc = 0; goto out; } - if ((flags & MUTT_SHOWCOLOR) && *force_redraw && (*lineInfo)[n + 1].offset > 0) + if ((flags & MUTT_SHOWCOLOR) && *force_redraw && (*line_info)[n + 1].offset > 0) { /* no need to try to display this line... */ rc = 1; goto out; /* fake display */ } - if ((b_read = fill_buffer(f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, + if ((b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready)) < 0) { if (change_last) @@ -1514,7 +1514,7 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n } /* now chose a good place to break the line */ - cnt = format_line(lineInfo, n, buf, flags, 0, b_read, &ch, &vch, &col, &special, pager_window); + cnt = format_line(line_info, n, buf, flags, 0, b_read, &ch, &vch, &col, &special, pager_window); buf_ptr = buf + cnt; /* move the break point only if smart_wrap is set */ @@ -1549,9 +1549,9 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n if (*buf_ptr == '\n') buf_ptr++; - if ((int) (buf_ptr - buf) < b_read && !(*lineInfo)[n + 1].continuation) - append_line(*lineInfo, n, (int) (buf_ptr - buf)); - (*lineInfo)[n + 1].offset = (*lineInfo)[n].offset + (long) (buf_ptr - buf); + if ((int) (buf_ptr - buf) < b_read && !(*line_info)[n + 1].continuation) + append_line(*line_info, n, (int) (buf_ptr - buf)); + (*line_info)[n + 1].offset = (*line_info)[n].offset + (long) (buf_ptr - buf); /* if we don't need to display the line we are done */ if (!(flags & MUTT_SHOW)) @@ -1561,7 +1561,7 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n } /* display the line */ - format_line(lineInfo, n, buf, flags, &a, cnt, &ch, &vch, &col, &special, pager_window); + format_line(line_info, n, buf, flags, &a, cnt, &ch, &vch, &col, &special, pager_window); /* avoid a bug in ncurses... */ #ifndef USE_SLANG_CURSES @@ -1574,7 +1574,7 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n /* end the last color pattern (needed by S-Lang) */ if (special || (col != pager_window->cols && (flags & (MUTT_SHOWCOLOR | MUTT_SEARCH)))) - resolve_color(*lineInfo, n, vch, flags, 0, &a); + resolve_color(*line_info, n, vch, flags, 0, &a); /* * Fill the blank space at the end of the line with the prevailing color. @@ -1583,11 +1583,11 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **lineInfo, int n */ if (flags & MUTT_SHOWCOLOR) { - m = ((*lineInfo)[n].continuation) ? ((*lineInfo)[n].syntax)[0].first : n; - if ((*lineInfo)[m].type == MT_COLOR_HEADER) - def_color = ((*lineInfo)[m].syntax)[0].color; + m = ((*line_info)[n].continuation) ? ((*line_info)[n].syntax)[0].first : n; + if ((*line_info)[m].type == MT_COLOR_HEADER) + def_color = ((*line_info)[m].syntax)[0].color; else - def_color = ColorDefs[(*lineInfo)[m].type]; + def_color = ColorDefs[(*line_info)[m].type]; ATTRSET(def_color); } @@ -1662,15 +1662,15 @@ struct PagerRedrawData int indicator; /* the indicator line of the PI */ int oldtopline; int lines; - int maxLine; - int lastLine; + int max_line; + int last_line; int curline; int topline; int force_redraw; int has_types; - int hideQuoted; + int hide_quoted; int q_level; - struct QClass *QuoteList; + struct QClass *quote_list; LOFF_T last_pos; LOFF_T last_offset; struct MuttWindow *index_status_window; @@ -1678,14 +1678,14 @@ struct PagerRedrawData struct MuttWindow *pager_status_window; struct MuttWindow *pager_window; struct Menu *index; /* the Pager Index (PI) */ - regex_t SearchRE; - int SearchCompiled; - int SearchFlag; - int SearchBack; + regex_t search_re; + int search_compiled; + int search_flag; + int search_back; const char *banner; char *helpstr; char *searchbuf; - struct Line *lineInfo; + struct Line *line_info; FILE *fp; struct stat sb; }; @@ -1762,11 +1762,11 @@ static void pager_menu_redraw(struct Menu *pager_menu) #if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM) if (Resize) { - if ((rd->SearchCompiled = Resize->SearchCompiled)) + if ((rd->search_compiled = Resize->search_compiled)) { - REGCOMP(&rd->SearchRE, rd->searchbuf, REG_NEWLINE | mutt_which_case(rd->searchbuf)); - rd->SearchFlag = MUTT_SEARCH; - rd->SearchBack = Resize->SearchBack; + REGCOMP(&rd->search_re, rd->searchbuf, REG_NEWLINE | mutt_which_case(rd->searchbuf)); + rd->search_flag = MUTT_SEARCH; + rd->search_back = Resize->search_back; } rd->lines = Resize->line; pager_menu->redraw |= REDRAW_FLOW; @@ -1818,35 +1818,35 @@ static void pager_menu_redraw(struct Menu *pager_menu) { rd->lines = -1; for (i = 0; i <= rd->topline; i++) - if (!rd->lineInfo[i].continuation) + if (!rd->line_info[i].continuation) rd->lines++; - for (i = 0; i < rd->maxLine; i++) + for (i = 0; i < rd->max_line; i++) { - rd->lineInfo[i].offset = 0; - rd->lineInfo[i].type = -1; - rd->lineInfo[i].continuation = 0; - rd->lineInfo[i].chunks = 0; - rd->lineInfo[i].search_cnt = -1; - rd->lineInfo[i].quote = NULL; - - safe_realloc(&(rd->lineInfo[i].syntax), sizeof(struct Syntax)); - if (rd->SearchCompiled && rd->lineInfo[i].search) - FREE(&(rd->lineInfo[i].search)); + rd->line_info[i].offset = 0; + rd->line_info[i].type = -1; + rd->line_info[i].continuation = 0; + rd->line_info[i].chunks = 0; + rd->line_info[i].search_cnt = -1; + rd->line_info[i].quote = NULL; + + safe_realloc(&(rd->line_info[i].syntax), sizeof(struct Syntax)); + if (rd->search_compiled && rd->line_info[i].search) + FREE(&(rd->line_info[i].search)); } - rd->lastLine = 0; + rd->last_line = 0; rd->topline = 0; } i = -1; j = -1; - while (display_line(rd->fp, &rd->last_pos, &rd->lineInfo, ++i, &rd->lastLine, &rd->maxLine, - rd->has_types | rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP), - &rd->QuoteList, &rd->q_level, &rd->force_redraw, - &rd->SearchRE, rd->pager_window) == 0) - if (!rd->lineInfo[i].continuation && ++j == rd->lines) + while (display_line(rd->fp, &rd->last_pos, &rd->line_info, ++i, &rd->last_line, &rd->max_line, + rd->has_types | rd->search_flag | (rd->flags & MUTT_PAGER_NOWRAP), + &rd->quote_list, &rd->q_level, &rd->force_redraw, + &rd->search_re, rd->pager_window) == 0) + if (!rd->line_info[i].continuation && ++j == rd->lines) { rd->topline = i; - if (!rd->SearchFlag) + if (!rd->search_flag) break; } } @@ -1868,19 +1868,19 @@ static void pager_menu_redraw(struct Menu *pager_menu) rd->force_redraw = 0; while (rd->lines < rd->pager_window->rows && - rd->lineInfo[rd->curline].offset <= rd->sb.st_size - 1) + rd->line_info[rd->curline].offset <= rd->sb.st_size - 1) { - if (display_line(rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline, - &rd->lastLine, &rd->maxLine, - (rd->flags & MUTT_DISPLAYFLAGS) | rd->hideQuoted | - rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP), - &rd->QuoteList, &rd->q_level, &rd->force_redraw, - &rd->SearchRE, rd->pager_window) > 0) + if (display_line(rd->fp, &rd->last_pos, &rd->line_info, rd->curline, + &rd->last_line, &rd->max_line, + (rd->flags & MUTT_DISPLAYFLAGS) | rd->hide_quoted | + rd->search_flag | (rd->flags & MUTT_PAGER_NOWRAP), + &rd->quote_list, &rd->q_level, &rd->force_redraw, + &rd->search_re, rd->pager_window) > 0) rd->lines++; rd->curline++; mutt_window_move(rd->pager_window, rd->lines, 0); } - rd->last_offset = rd->lineInfo[rd->curline].offset; + rd->last_offset = rd->line_info[rd->curline].offset; } while (rd->force_redraw); SETCOLOR(MT_COLOR_TILDE); @@ -2027,14 +2027,14 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e mutt_set_flag(Context, extra->hdr, MUTT_READ, 1); } - rd.lineInfo = safe_malloc(sizeof(struct Line) * (rd.maxLine = LINES)); - for (i = 0; i < rd.maxLine; i++) + rd.line_info = safe_malloc(sizeof(struct Line) * (rd.max_line = LINES)); + for (i = 0; i < rd.max_line; i++) { - memset(&rd.lineInfo[i], 0, sizeof(struct Line)); - rd.lineInfo[i].type = -1; - rd.lineInfo[i].search_cnt = -1; - rd.lineInfo[i].syntax = safe_malloc(sizeof(struct Syntax)); - (rd.lineInfo[i].syntax)[0].first = (rd.lineInfo[i].syntax)[0].last = -1; + memset(&rd.line_info[i], 0, sizeof(struct Line)); + rd.line_info[i].type = -1; + rd.line_info[i].search_cnt = -1; + rd.line_info[i].syntax = safe_malloc(sizeof(struct Syntax)); + (rd.line_info[i].syntax)[0].first = (rd.line_info[i].syntax)[0].last = -1; } mutt_compile_help(helpstr, sizeof(helpstr), MENU_PAGER, PagerHelp); @@ -2085,7 +2085,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e mutt_refresh(); if (IsHeader(extra) && OldHdr == extra->hdr && TopLine != rd.topline && - rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1) + rd.line_info[rd.curline].offset < rd.sb.st_size - 1) { if (TopLine - rd.topline > rd.lines) rd.topline += rd.lines; @@ -2192,14 +2192,14 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e /* Store current position. */ rd.lines = -1; for (i = 0; i <= rd.topline; i++) - if (!rd.lineInfo[i].continuation) + if (!rd.line_info[i].continuation) rd.lines++; Resize = safe_malloc(sizeof(struct Resize)); Resize->line = rd.lines; - Resize->SearchCompiled = rd.SearchCompiled; - Resize->SearchBack = rd.SearchBack; + Resize->search_compiled = rd.search_compiled; + Resize->search_back = rd.search_back; ch = -1; rc = OP_REFORMAT_WINCH; @@ -2239,9 +2239,9 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; case OP_NEXT_PAGE: - if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1) + if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1) { - rd.topline = up_n_lines(PagerContext, rd.lineInfo, rd.curline, rd.hideQuoted); + rd.topline = up_n_lines(PagerContext, rd.line_info, rd.curline, rd.hide_quoted); } else if (option(OPTPAGERSTOP)) { @@ -2260,19 +2260,19 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e if (rd.topline != 0) { rd.topline = up_n_lines(rd.pager_window->rows - PagerContext, - rd.lineInfo, rd.topline, rd.hideQuoted); + rd.line_info, rd.topline, rd.hide_quoted); } else mutt_error(_("Top of message is shown.")); break; case OP_NEXT_LINE: - if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1) + if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1) { rd.topline++; - if (rd.hideQuoted) + if (rd.hide_quoted) { - while (rd.lineInfo[rd.topline].type == MT_COLOR_QUOTED && rd.topline < rd.lastLine) + while (rd.line_info[rd.topline].type == MT_COLOR_QUOTED && rd.topline < rd.last_line) rd.topline++; } } @@ -2282,7 +2282,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e case OP_PREV_LINE: if (rd.topline) - rd.topline = up_n_lines(1, rd.lineInfo, rd.topline, rd.hideQuoted); + rd.topline = up_n_lines(1, rd.line_info, rd.topline, rd.hide_quoted); else mutt_error(_("Top of message is shown.")); break; @@ -2296,17 +2296,17 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e case OP_HALF_UP: if (rd.topline) - rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.lineInfo, - rd.topline, rd.hideQuoted); + rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.line_info, + rd.topline, rd.hide_quoted); else mutt_error(_("Top of message is shown.")); break; case OP_HALF_DOWN: - if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1) + if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1) { - rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.lineInfo, - rd.curline, rd.hideQuoted); + rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.line_info, + rd.curline, rd.hide_quoted); } else if (option(OPTPAGERSTOP)) { @@ -2323,7 +2323,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e case OP_SEARCH_NEXT: case OP_SEARCH_OPPOSITE: - if (rd.SearchCompiled) + if (rd.search_compiled) { wrapped = false; @@ -2333,18 +2333,18 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e searchctx = 0; search_next: - if ((!rd.SearchBack && ch == OP_SEARCH_NEXT) || - (rd.SearchBack && ch == OP_SEARCH_OPPOSITE)) + if ((!rd.search_back && ch == OP_SEARCH_NEXT) || + (rd.search_back && ch == OP_SEARCH_OPPOSITE)) { /* searching forward */ - for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.lastLine; i++) + for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.last_line; i++) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && - !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) + if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) && + !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0) break; } - if (i < rd.lastLine) + if (i < rd.last_line) rd.topline = i; else if (wrapped || !option(OPTWRAPSEARCH)) mutt_error(_("Not found.")); @@ -2358,10 +2358,10 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e else { /* searching backward */ - for (i = wrapped ? rd.lastLine : rd.topline + searchctx - 1; i >= 0; i--) + for (i = wrapped ? rd.last_line : rd.topline + searchctx - 1; i >= 0; i--) { - if ((!rd.hideQuoted || (rd.has_types && rd.lineInfo[i].type != MT_COLOR_QUOTED)) && - !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) + if ((!rd.hide_quoted || (rd.has_types && rd.line_info[i].type != MT_COLOR_QUOTED)) && + !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0) break; } @@ -2377,9 +2377,9 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e } } - if (rd.lineInfo[rd.topline].search_cnt > 0) + if (rd.line_info[rd.topline].search_cnt > 0) { - rd.SearchFlag = MUTT_SEARCH; + rd.search_flag = MUTT_SEARCH; /* give some context for search results */ if (rd.topline - searchctx > 0) rd.topline -= searchctx; @@ -2400,7 +2400,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e if (strcmp(buffer, searchbuf) == 0) { - if (rd.SearchCompiled) + if (rd.search_compiled) { /* do an implicit search-next */ if (ch == OP_SEARCH) @@ -2418,60 +2418,60 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e strfcpy(searchbuf, buffer, sizeof(searchbuf)); - /* leave SearchBack alone if ch == OP_SEARCH_NEXT */ + /* leave search_back alone if ch == OP_SEARCH_NEXT */ if (ch == OP_SEARCH) - rd.SearchBack = 0; + rd.search_back = 0; else if (ch == OP_SEARCH_REVERSE) - rd.SearchBack = 1; + rd.search_back = 1; - if (rd.SearchCompiled) + if (rd.search_compiled) { - regfree(&rd.SearchRE); - for (i = 0; i < rd.lastLine; i++) + regfree(&rd.search_re); + for (i = 0; i < rd.last_line; i++) { - if (rd.lineInfo[i].search) - FREE(&(rd.lineInfo[i].search)); - rd.lineInfo[i].search_cnt = -1; + if (rd.line_info[i].search) + FREE(&(rd.line_info[i].search)); + rd.line_info[i].search_cnt = -1; } } - if ((err = REGCOMP(&rd.SearchRE, searchbuf, + if ((err = REGCOMP(&rd.search_re, searchbuf, REG_NEWLINE | mutt_which_case(searchbuf))) != 0) { - regerror(err, &rd.SearchRE, buffer, sizeof(buffer)); + regerror(err, &rd.search_re, buffer, sizeof(buffer)); mutt_error("%s", buffer); - for (i = 0; i < rd.maxLine; i++) + for (i = 0; i < rd.max_line; i++) { /* cleanup */ - if (rd.lineInfo[i].search) - FREE(&(rd.lineInfo[i].search)); - rd.lineInfo[i].search_cnt = -1; + if (rd.line_info[i].search) + FREE(&(rd.line_info[i].search)); + rd.line_info[i].search_cnt = -1; } - rd.SearchFlag = 0; - rd.SearchCompiled = 0; + rd.search_flag = 0; + rd.search_compiled = 0; } else { - rd.SearchCompiled = 1; + rd.search_compiled = 1; /* update the search pointers */ i = 0; - while (display_line(rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, &rd.maxLine, + while (display_line(rd.fp, &rd.last_pos, &rd.line_info, i, &rd.last_line, &rd.max_line, MUTT_SEARCH | (flags & MUTT_PAGER_NSKIP) | (flags & MUTT_PAGER_NOWRAP), - &rd.QuoteList, &rd.q_level, &rd.force_redraw, - &rd.SearchRE, rd.pager_window) == 0) + &rd.quote_list, &rd.q_level, &rd.force_redraw, + &rd.search_re, rd.pager_window) == 0) i++; - if (!rd.SearchBack) + if (!rd.search_back) { /* searching forward */ - for (i = rd.topline; i < rd.lastLine; i++) + for (i = rd.topline; i < rd.last_line; i++) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && - !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) + if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) && + !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0) break; } - if (i < rd.lastLine) + if (i < rd.last_line) rd.topline = i; } else @@ -2479,8 +2479,8 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e /* searching backward */ for (i = rd.topline; i >= 0; i--) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && - !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) + if ((!rd.hide_quoted || rd.line_info[i].type != MT_COLOR_QUOTED) && + !rd.line_info[i].continuation && rd.line_info[i].search_cnt > 0) break; } @@ -2488,14 +2488,14 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e rd.topline = i; } - if (rd.lineInfo[rd.topline].search_cnt == 0) + if (rd.line_info[rd.topline].search_cnt == 0) { - rd.SearchFlag = 0; + rd.search_flag = 0; mutt_error(_("Not found.")); } else { - rd.SearchFlag = MUTT_SEARCH; + rd.search_flag = MUTT_SEARCH; /* give some context for search results */ if (SearchContext > 0 && SearchContext < rd.pager_window->rows) searchctx = SearchContext; @@ -2509,9 +2509,9 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; case OP_SEARCH_TOGGLE: - if (rd.SearchCompiled) + if (rd.search_compiled) { - rd.SearchFlag ^= MUTT_SEARCH; + rd.search_flag ^= MUTT_SEARCH; pager_menu->redraw = REDRAW_BODY; } break; @@ -2543,9 +2543,9 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e case OP_PAGER_HIDE_QUOTED: if (rd.has_types) { - rd.hideQuoted ^= MUTT_HIDE; - if (rd.hideQuoted && rd.lineInfo[rd.topline].type == MT_COLOR_QUOTED) - rd.topline = up_n_lines(1, rd.lineInfo, rd.topline, rd.hideQuoted); + rd.hide_quoted ^= MUTT_HIDE; + if (rd.hide_quoted && rd.line_info[rd.topline].type == MT_COLOR_QUOTED) + rd.topline = up_n_lines(1, rd.line_info, rd.topline, rd.hide_quoted); else pager_menu->redraw = REDRAW_BODY; } @@ -2558,15 +2558,15 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e int new_topline = rd.topline; /* Skip all the email headers */ - if (ISHEADER(rd.lineInfo[new_topline].type)) + if (ISHEADER(rd.line_info[new_topline].type)) { - while ((new_topline < rd.lastLine || + while ((new_topline < rd.last_line || (0 == (dretval = display_line( - rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine, - &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), - &rd.QuoteList, &rd.q_level, &rd.force_redraw, - &rd.SearchRE, rd.pager_window)))) && - ISHEADER(rd.lineInfo[new_topline].type)) + rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, + &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), + &rd.quote_list, &rd.q_level, &rd.force_redraw, + &rd.search_re, rd.pager_window)))) && + ISHEADER(rd.line_info[new_topline].type)) { new_topline++; } @@ -2574,13 +2574,13 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; } - while (((new_topline + SkipQuotedOffset) < rd.lastLine || + while (((new_topline + SkipQuotedOffset) < rd.last_line || (0 == (dretval = display_line( - rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine, - &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), - &rd.QuoteList, &rd.q_level, &rd.force_redraw, - &rd.SearchRE, rd.pager_window)))) && - rd.lineInfo[new_topline + SkipQuotedOffset].type != MT_COLOR_QUOTED) + rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, + &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), + &rd.quote_list, &rd.q_level, &rd.force_redraw, + &rd.search_re, rd.pager_window)))) && + rd.line_info[new_topline + SkipQuotedOffset].type != MT_COLOR_QUOTED) new_topline++; if (dretval < 0) @@ -2589,13 +2589,13 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; } - while (((new_topline + SkipQuotedOffset) < rd.lastLine || + while (((new_topline + SkipQuotedOffset) < rd.last_line || (0 == (dretval = display_line( - rd.fp, &rd.last_pos, &rd.lineInfo, new_topline, &rd.lastLine, - &rd.maxLine, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), - &rd.QuoteList, &rd.q_level, &rd.force_redraw, - &rd.SearchRE, rd.pager_window)))) && - rd.lineInfo[new_topline + SkipQuotedOffset].type == MT_COLOR_QUOTED) + rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, + &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), + &rd.quote_list, &rd.q_level, &rd.force_redraw, + &rd.search_re, rd.pager_window)))) && + rd.line_info[new_topline + SkipQuotedOffset].type == MT_COLOR_QUOTED) new_topline++; if (dretval < 0) @@ -2608,17 +2608,17 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; case OP_PAGER_BOTTOM: /* move to the end of the file */ - if (rd.lineInfo[rd.curline].offset < rd.sb.st_size - 1) + if (rd.line_info[rd.curline].offset < rd.sb.st_size - 1) { i = rd.curline; /* make sure the types are defined to the end of file */ - while (display_line(rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, - &rd.maxLine, rd.has_types | (flags & MUTT_PAGER_NOWRAP), - &rd.QuoteList, &rd.q_level, &rd.force_redraw, - &rd.SearchRE, rd.pager_window) == 0) + while (display_line(rd.fp, &rd.last_pos, &rd.line_info, i, &rd.last_line, + &rd.max_line, rd.has_types | (flags & MUTT_PAGER_NOWRAP), + &rd.quote_list, &rd.q_level, &rd.force_redraw, + &rd.search_re, rd.pager_window) == 0) i++; - rd.topline = up_n_lines(rd.pager_window->rows, rd.lineInfo, - rd.lastLine, rd.hideQuoted); + rd.topline = up_n_lines(rd.pager_window->rows, rd.line_info, + rd.last_line, rd.hide_quoted); } else mutt_error(_("Bottom of message is shown.")); @@ -3167,20 +3167,20 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e } } - cleanup_quote(&rd.QuoteList); + cleanup_quote(&rd.quote_list); - for (i = 0; i < rd.maxLine; i++) + for (i = 0; i < rd.max_line; i++) { - FREE(&(rd.lineInfo[i].syntax)); - if (rd.SearchCompiled && rd.lineInfo[i].search) - FREE(&(rd.lineInfo[i].search)); + FREE(&(rd.line_info[i].syntax)); + if (rd.search_compiled && rd.line_info[i].search) + FREE(&(rd.line_info[i].search)); } - if (rd.SearchCompiled) + if (rd.search_compiled) { - regfree(&rd.SearchRE); - rd.SearchCompiled = 0; + regfree(&rd.search_re); + rd.search_compiled = 0; } - FREE(&rd.lineInfo); + FREE(&rd.line_info); mutt_pop_current_menu(pager_menu); mutt_menu_destroy(&pager_menu); if (rd.index) diff --git a/pattern.c b/pattern.c index 40dacaab9..6fc8a7490 100644 --- a/pattern.c +++ b/pattern.c @@ -1333,7 +1333,7 @@ struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer return curlist; } -static bool perform_and(struct Pattern *pat, pattern_exec_flag flags, struct Context *ctx, +static bool perform_and(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct Header *hdr, struct PatternCache *cache) { for (; pat; pat = pat->next) @@ -1342,7 +1342,7 @@ static bool perform_and(struct Pattern *pat, pattern_exec_flag flags, struct Con return true; } -static int perform_or(struct Pattern *pat, pattern_exec_flag flags, struct Context *ctx, +static int perform_or(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct Header *hdr, struct PatternCache *cache) { for (; pat; pat = pat->next) @@ -1423,7 +1423,7 @@ static int match_user(int alladdr, struct Address *a1, struct Address *a2) return alladdr; } -static int match_threadcomplete(struct Pattern *pat, pattern_exec_flag flags, +static int match_threadcomplete(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct MuttThread *t, int left, int up, int right, int down) { @@ -1450,7 +1450,7 @@ static int match_threadcomplete(struct Pattern *pat, pattern_exec_flag flags, return 0; } -static int match_threadparent(struct Pattern *pat, pattern_exec_flag flags, +static int match_threadparent(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct MuttThread *t) { if (!t || !t->parent || !t->parent->message) @@ -1459,7 +1459,7 @@ static int match_threadparent(struct Pattern *pat, pattern_exec_flag flags, return mutt_pattern_exec(pat, flags, ctx, t->parent->message, NULL); } -static int match_threadchildren(struct Pattern *pat, pattern_exec_flag flags, +static int match_threadchildren(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct MuttThread *t) { if (!t || !t->child) @@ -1497,7 +1497,7 @@ static int is_pattern_cache_set(int cache_entry) * flags: MUTT_MATCH_FULL_ADDRESS - match both personal and machine address * cache: For repeated matches against the same Header, passing in non-NULL will * store some of the cacheable pattern matches in this structure. */ -int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags, +int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct Header *h, struct PatternCache *cache) { int result; diff --git a/pattern.h b/pattern.h index aaaa2a2c7..a6213b1b1 100644 --- a/pattern.h +++ b/pattern.h @@ -48,9 +48,10 @@ struct Pattern } p; }; -typedef enum { +enum PatternExecFlag +{ MUTT_MATCH_FULL_ADDRESS = 1 -} pattern_exec_flag; +}; /* This is used when a message is repeatedly pattern matched against. * e.g. for color, scoring, hooks. It caches a few of the potentially slow @@ -74,7 +75,7 @@ static inline struct Pattern *new_pattern(void) return safe_calloc(1, sizeof(struct Pattern)); } -int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags, +int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, struct Context *ctx, struct Header *h, struct PatternCache *cache); struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err); void mutt_check_simple(char *s, size_t len, const char *simple); diff --git a/pop.h b/pop.h index 1faddffad..5d138406e 100644 --- a/pop.h +++ b/pop.h @@ -44,12 +44,13 @@ enum POP_BYE }; -typedef enum { +enum PopAuthRes +{ POP_A_SUCCESS = 0, POP_A_SOCKET, POP_A_FAILURE, POP_A_UNAVAIL -} pop_auth_res_t; +}; struct PopCache { @@ -84,7 +85,7 @@ struct PopData struct PopAuth { /* do authentication, using named method or any available if method is NULL */ - pop_auth_res_t (*authenticate)(struct PopData *, const char *); + enum PopAuthRes (*authenticate)(struct PopData *, const char *); /* name of authentication method supported, NULL means variable. If this * is not null, authenticate may ignore the second parameter. */ const char *method; diff --git a/pop_auth.c b/pop_auth.c index 0f9f1d302..68edc5f2b 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -37,7 +37,7 @@ #ifdef USE_SASL /* SASL authenticator */ -static pop_auth_res_t pop_auth_sasl(struct PopData *pop_data, const char *method) +static enum PopAuthRes pop_auth_sasl(struct PopData *pop_data, const char *method) { sasl_conn_t *saslconn = NULL; sasl_interact_t *interaction = NULL; @@ -201,7 +201,7 @@ void pop_apop_timestamp(struct PopData *pop_data, char *buf) } /* APOP authenticator */ -static pop_auth_res_t pop_auth_apop(struct PopData *pop_data, const char *method) +static enum PopAuthRes pop_auth_apop(struct PopData *pop_data, const char *method) { struct Md5Ctx ctx; unsigned char digest[16]; @@ -248,7 +248,7 @@ static pop_auth_res_t pop_auth_apop(struct PopData *pop_data, const char *method } /* USER authenticator */ -static pop_auth_res_t pop_auth_user(struct PopData *pop_data, const char *method) +static enum PopAuthRes pop_auth_user(struct PopData *pop_data, const char *method) { char buf[LONG_STRING]; int ret; diff --git a/protos.h b/protos.h index 7ea4fa35f..fa12350d8 100644 --- a/protos.h +++ b/protos.h @@ -52,7 +52,7 @@ struct passwd; #define mutt_make_string(A, B, C, D, E) _mutt_make_string(A, B, C, D, E, 0) void _mutt_make_string(char *dest, size_t destlen, const char *s, struct Context *ctx, - struct Header *hdr, format_flag flags); + struct Header *hdr, enum FormatFlag flags); struct HdrFormatInfo { @@ -61,13 +61,14 @@ struct HdrFormatInfo const char *pager_progress; }; -typedef enum { - kXDGConfigHome, /* $XDG_CONFIG_HOME */ - kXDGConfigDirs, /* $XDG_CONFIG_DIRS */ -} XDGType; +enum XdgType +{ + XDG_CONFIG_HOME, + XDG_CONFIG_DIRS, +}; void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s, - struct HdrFormatInfo *hfi, format_flag flags); + struct HdrFormatInfo *hfi, enum FormatFlag flags); void mutt_free_opts(void); @@ -121,7 +122,7 @@ void mutt_touch_atime(int f); const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags); + unsigned long data, enum FormatFlag flags); char *mutt_charset_hook(const char *chs); @@ -136,7 +137,7 @@ struct List *mutt_crypt_hook(struct Address *adr); char *mutt_make_date(char *s, size_t len); void mutt_timeout_hook(void); void mutt_startup_shutdown_hook(int type); -int mutt_set_xdg_path(const XDGType type, char *buf, size_t bufsize); +int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize); const char *mutt_make_version(void); diff --git a/query.c b/query.c index 74b4beb5e..f01da3e51 100644 --- a/query.c +++ b/query.c @@ -192,7 +192,7 @@ static int query_search(struct Menu *m, regex_t *re, int n) static const char *query_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { struct Entry *entry = (struct Entry *) data; struct Query *query = entry->data; diff --git a/recvattach.c b/recvattach.c index b6f6e2527..66ce26542 100644 --- a/recvattach.c +++ b/recvattach.c @@ -170,7 +170,7 @@ struct AttachPtr **mutt_gen_attach_list(struct Body *m, int parent_type, const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; char tmp[SHORT_STRING]; diff --git a/remailer.c b/remailer.c index 620de2f85..6d1c5944c 100644 --- a/remailer.c +++ b/remailer.c @@ -351,7 +351,7 @@ static const char *mix_format_caps(struct Remailer *r) static const char *mix_entry_fmt(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[16]; struct Remailer *remailer = (struct Remailer *) data; diff --git a/sidebar.c b/sidebar.c index ffdf7724c..b7075d947 100644 --- a/sidebar.c +++ b/sidebar.c @@ -64,14 +64,14 @@ static int HilIndex = -1; /* Highlighted mailbox */ static int BotIndex = -1; /* Last mailbox visible in sidebar */ /* The source of the sidebar divider character. */ -enum div_type +enum DivType { SB_DIV_USER, SB_DIV_ASCII, SB_DIV_UTF8 }; -enum sb_src +enum SidebarSrc { SB_SRC_INCOMING, SB_SRC_VIRT, @@ -101,7 +101,7 @@ enum sb_src static const char *cb_format_str(char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { struct SbEntry *sbe = (struct SbEntry *) data; unsigned int optional; @@ -690,7 +690,7 @@ static int draw_divider(int num_rows, int num_cols) int i; int delim_len; - enum div_type altchar = SB_DIV_UTF8; + enum DivType altchar = SB_DIV_UTF8; /* Calculate the width of the delimiter in screen cells */ delim_len = mutt_strwidth(SidebarDividerChar); diff --git a/status.c b/status.c index 394e5c874..d346680ae 100644 --- a/status.c +++ b/status.c @@ -66,7 +66,7 @@ static void _menu_status_line(char *buf, size_t buflen, size_t col, int cols, static const char *status_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, - unsigned long data, format_flag flags) + unsigned long data, enum FormatFlag flags) { char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp = NULL; int count, optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/url.c b/url.c index 7c91c9b12..184b177d6 100644 --- a/url.c +++ b/url.c @@ -72,7 +72,7 @@ int url_pct_decode(char *s) return 0; } -url_scheme_t url_check_scheme(const char *s) +enum UrlScheme url_check_scheme(const char *s) { char sbuf[STRING]; char *t = NULL; @@ -90,7 +90,7 @@ url_scheme_t url_check_scheme(const char *s) if ((i = mutt_getvaluebyname(sbuf, UrlMap)) == -1) return U_UNKNOWN; else - return (url_scheme_t) i; + return (enum UrlScheme) i; } /* ciss_parse_userhost: fill in components of ciss with info from src. Note diff --git a/url.h b/url.h index e76f7272d..ad4ec142d 100644 --- a/url.h +++ b/url.h @@ -20,7 +20,8 @@ struct Envelope; -typedef enum url_scheme { +enum UrlScheme +{ U_FILE, U_POP, U_POPS, @@ -35,14 +36,14 @@ typedef enum url_scheme { U_NOTMUCH, #endif U_UNKNOWN -} url_scheme_t; +}; #define U_DECODE_PASSWD (1) #define U_PATH (1 << 1) struct CissUrl { - url_scheme_t scheme; + enum UrlScheme scheme; char *user; char *pass; char *host; @@ -50,7 +51,7 @@ struct CissUrl char *path; }; -url_scheme_t url_check_scheme(const char *s); +enum UrlScheme url_check_scheme(const char *s); int url_parse_ciss(struct CissUrl *ciss, char *src); int url_ciss_tostring(struct CissUrl *ciss, char *dest, size_t len, int flags); int url_parse_mailto(struct Envelope *e, char **body, const char *src);