From 3724a6debd69f7951edf543b04c0adec1e9e2c51 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 29 Aug 2019 14:29:59 +0100 Subject: [PATCH] rename two duplicate `struct Entry` --- autocrypt/autocrypt_acct_menu.c | 23 ++++++++++++----------- query.c | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/autocrypt/autocrypt_acct_menu.c b/autocrypt/autocrypt_acct_menu.c index 589858d0b..8b9ed4371 100644 --- a/autocrypt/autocrypt_acct_menu.c +++ b/autocrypt/autocrypt_acct_menu.c @@ -45,9 +45,9 @@ #include "opcodes.h" /** - * struct Entry - An entry in the Autocrypt account Menu + * struct AccountEntry - An entry in the Autocrypt account Menu */ -struct Entry +struct AccountEntry { int tagged; /* TODO */ int num; @@ -99,7 +99,7 @@ static const char *account_format_str(char *dest, size_t destlen, size_t col, in const char *ifstring, const char *elsestring, unsigned long data, MuttFormatFlags flags) { - struct Entry *entry = (struct Entry *) data; + struct AccountEntry *entry = (struct AccountEntry *) data; char tmp[128]; switch (op) @@ -157,7 +157,7 @@ static const char *account_format_str(char *dest, size_t destlen, size_t col, in */ static void account_entry(char *buf, size_t buflen, struct Menu *menu, int num) { - struct Entry *entry = &((struct Entry *) menu->data)[num]; + struct AccountEntry *entry = &((struct AccountEntry *) menu->data)[num]; mutt_expando_format(buf, buflen, 0, menu->indexwin->cols, NONULL(C_AutocryptAcctFormat), account_format_str, @@ -184,7 +184,8 @@ static struct Menu *create_menu(void) char *helpstr = mutt_mem_malloc(256); menu->help = mutt_compile_help(helpstr, 256, MENU_AUTOCRYPT_ACCT, AutocryptAcctHelp); - struct Entry *entries = mutt_mem_calloc(num_accounts, sizeof(struct Entry)); + struct AccountEntry *entries = + mutt_mem_calloc(num_accounts, sizeof(struct AccountEntry)); menu->data = entries; menu->max = num_accounts; @@ -213,7 +214,7 @@ static struct Menu *create_menu(void) */ static void free_menu(struct Menu **menu) { - struct Entry *entries = (struct Entry *) (*menu)->data; + struct AccountEntry *entries = (struct AccountEntry *) (*menu)->data; for (int i = 0; i < (*menu)->max; i++) { @@ -231,7 +232,7 @@ static void free_menu(struct Menu **menu) * toggle_active - Toggle whether an Autocrypt account is active * @param entry Menu Entry for the account */ -static void toggle_active(struct Entry *entry) +static void toggle_active(struct AccountEntry *entry) { entry->account->enabled = !entry->account->enabled; if (mutt_autocrypt_db_account_update(entry->account) != 0) @@ -249,7 +250,7 @@ static void toggle_active(struct Entry *entry) * toggle_prefer_encrypt - Toggle whether an Autocrypt account prefers encryption * @param entry Menu Entry for the account */ -static void toggle_prefer_encrypt(struct Entry *entry) +static void toggle_prefer_encrypt(struct AccountEntry *entry) { entry->account->prefer_encrypt = !entry->account->prefer_encrypt; if (mutt_autocrypt_db_account_update(entry->account)) @@ -294,7 +295,7 @@ void mutt_autocrypt_account_menu(void) case OP_AUTOCRYPT_DELETE_ACCT: if (menu->data) { - struct Entry *entry = (struct Entry *) (menu->data) + menu->current; + struct AccountEntry *entry = (struct AccountEntry *) (menu->data) + menu->current; char msg[128]; snprintf(msg, sizeof(msg), // L10N: Confirmation message when deleting an autocrypt account @@ -313,7 +314,7 @@ void mutt_autocrypt_account_menu(void) case OP_AUTOCRYPT_TOGGLE_ACTIVE: if (menu->data) { - struct Entry *entry = (struct Entry *) (menu->data) + menu->current; + struct AccountEntry *entry = (struct AccountEntry *) (menu->data) + menu->current; toggle_active(entry); menu->redraw |= REDRAW_FULL; } @@ -322,7 +323,7 @@ void mutt_autocrypt_account_menu(void) case OP_AUTOCRYPT_TOGGLE_PREFER: if (menu->data) { - struct Entry *entry = (struct Entry *) (menu->data) + menu->current; + struct AccountEntry *entry = (struct AccountEntry *) (menu->data) + menu->current; toggle_prefer_encrypt(entry); menu->redraw |= REDRAW_FULL; } diff --git a/query.c b/query.c index 62c5c658c..7de0c9536 100644 --- a/query.c +++ b/query.c @@ -67,9 +67,9 @@ struct Query }; /** - * struct Entry - An entry in a selectable list of Query's + * struct QueryEntry - An entry in a selectable list of Query's */ -struct Entry +struct QueryEntry { bool tagged; struct Query *data; @@ -231,7 +231,7 @@ static struct Query *run_query(char *s, int quiet) */ static int query_search(struct Menu *menu, regex_t *rx, int line) { - struct Entry *table = menu->data; + struct QueryEntry *table = menu->data; struct Query *query = table[line].data; if (query->name && !regexec(rx, query->name, 0, NULL, 0)) @@ -270,7 +270,7 @@ static const char *query_format_str(char *buf, size_t buflen, size_t col, int co const char *if_str, const char *else_str, unsigned long data, MuttFormatFlags flags) { - struct Entry *entry = (struct Entry *) data; + struct QueryEntry *entry = (struct QueryEntry *) data; struct Query *query = entry->data; char fmt[128]; char tmp[256] = { 0 }; @@ -320,7 +320,7 @@ static const char *query_format_str(char *buf, size_t buflen, size_t col, int co */ static void query_make_entry(char *buf, size_t buflen, struct Menu *menu, int line) { - struct Entry *entry = &((struct Entry *) menu->data)[line]; + struct QueryEntry *entry = &((struct QueryEntry *) menu->data)[line]; entry->data->num = line; mutt_expando_format(buf, buflen, 0, menu->indexwin->cols, NONULL(C_QueryFormat), @@ -332,7 +332,7 @@ static void query_make_entry(char *buf, size_t buflen, struct Menu *menu, int li */ static int query_tag(struct Menu *menu, int sel, int act) { - struct Entry *cur = &((struct Entry *) menu->data)[sel]; + struct QueryEntry *cur = &((struct QueryEntry *) menu->data)[sel]; bool ot = cur->tagged; cur->tagged = ((act >= 0) ? act : !cur->tagged); @@ -349,7 +349,7 @@ static int query_tag(struct Menu *menu, int sel, int act) static void query_menu(char *buf, size_t buflen, struct Query *results, bool retbuf) { struct Menu *menu = NULL; - struct Entry *query_table = NULL; + struct QueryEntry *query_table = NULL; struct Query *queryp = NULL; char title[256]; @@ -379,7 +379,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret for (queryp = results; queryp; queryp = queryp->next) menu->max++; - query_table = mutt_mem_calloc(menu->max, sizeof(struct Entry)); + query_table = mutt_mem_calloc(menu->max, sizeof(struct QueryEntry)); menu->data = query_table; queryp = results; @@ -436,7 +436,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret if (op == OP_QUERY) { menu->data = query_table = - mutt_mem_calloc(menu->max, sizeof(struct Entry)); + mutt_mem_calloc(menu->max, sizeof(struct QueryEntry)); queryp = results; for (int i = 0; queryp; queryp = queryp->next, i++) @@ -447,7 +447,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret bool clear = false; /* append */ - mutt_mem_realloc(&query_table, menu->max * sizeof(struct Entry)); + mutt_mem_realloc(&query_table, menu->max * sizeof(struct QueryEntry)); menu->data = query_table; -- 2.40.0