From 2fc73448beee442d3a43c3258c9ba4491dbf5da6 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 15 May 2017 14:42:40 +0100 Subject: [PATCH] replace 'mbchar_table' with 'struct MbCharTable' --- globals.h | 8 ++++---- hdrline.c | 2 +- init.c | 24 ++++++++++++------------ mutt.h | 4 ++-- mutt_lua.c | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/globals.h b/globals.h index adcba6fa7..df385caf6 100644 --- a/globals.h +++ b/globals.h @@ -57,7 +57,7 @@ WHERE char *EscChar; WHERE char *FolderFormat; WHERE char *ForwFmt; WHERE char *Fqdn; -WHERE mbchar_table *Fromchars; +WHERE struct MbCharTable *Fromchars; WHERE char *HdrFmt; WHERE char *HistFile; WHERE char *Homedir; @@ -163,11 +163,11 @@ WHERE short SslDHPrimeBits; WHERE char *SslCACertFile INITVAL(NULL); #endif #endif -WHERE mbchar_table *StChars; +WHERE struct MbCharTable *StChars; WHERE char *Status; WHERE char *Tempdir; -WHERE mbchar_table *Tochars; -WHERE mbchar_table *Flagchars; +WHERE struct MbCharTable *Tochars; +WHERE struct MbCharTable *Flagchars; WHERE char *TrashPath; WHERE char *TSStatusFormat; WHERE char *TSIconFormat; diff --git a/hdrline.c b/hdrline.c index 130f9694e..0a275d5dc 100644 --- a/hdrline.c +++ b/hdrline.c @@ -162,7 +162,7 @@ enum FieldType * If the index is invalid, then a space character will be returned. * If the character selected is '\n' (Ctrl-M), then "" will be returned. */ -static char *get_nth_wchar(mbchar_table *table, int index) +static char *get_nth_wchar(struct MbCharTable *table, int index) { if (!table || !table->chars || (index < 0) || (index >= table->len)) return " "; diff --git a/init.c b/init.c index 8df59acd4..5a269d933 100644 --- a/init.c +++ b/init.c @@ -254,7 +254,7 @@ const struct option_t *mutt_option_get(const char *s) } #endif -static void free_mbchar_table(mbchar_table **t) +static void free_mbchar_table(struct MbCharTable **t) { if (!t || !*t) return; @@ -265,14 +265,14 @@ static void free_mbchar_table(mbchar_table **t) FREE(t); } -static mbchar_table *parse_mbchar_table(const char *s) +static struct MbCharTable *parse_mbchar_table(const char *s) { - mbchar_table *t = NULL; + struct MbCharTable *t = NULL; size_t slen, k; mbstate_t mbstate; char *d = NULL; - t = safe_calloc(1, sizeof(mbchar_table)); + t = safe_calloc(1, sizeof(struct MbCharTable)); slen = mutt_strlen(s); if (!slen) return t; @@ -423,7 +423,7 @@ int mutt_option_set(const struct option_t *val, struct Buffer *err) break; case DT_MBCHARTBL: { - mbchar_table **tbl = (mbchar_table **) MuttVars[idx].data; + struct MbCharTable **tbl = (struct MbCharTable **) MuttVars[idx].data; free_mbchar_table(tbl); *tbl = parse_mbchar_table((const char *) val->data); } @@ -1908,8 +1908,8 @@ static void restore_default(struct option_t *p) mutt_str_replace((char **) p->data, (char *) p->init); break; case DT_MBCHARTBL: - free_mbchar_table((mbchar_table **) p->data); - *((mbchar_table **) p->data) = parse_mbchar_table((char *) p->init); + free_mbchar_table((struct MbCharTable **) p->data); + *((struct MbCharTable **) p->data) = parse_mbchar_table((char *) p->init); break; case DT_PATH: FREE((char **) p->data); @@ -2465,7 +2465,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, s else if (DTYPE(MuttVars[idx].type) == DT_ADDR) rfc822_free_address((struct Address **) MuttVars[idx].data); else if (DTYPE(MuttVars[idx].type) == DT_MBCHARTBL) - free_mbchar_table((mbchar_table **) MuttVars[idx].data); + free_mbchar_table((struct MbCharTable **) MuttVars[idx].data); else /* MuttVars[idx].data is already 'char**' (or some 'void**') or... * so cast to 'void*' is okay */ @@ -2504,7 +2504,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, s } else if (DTYPE(MuttVars[idx].type) == DT_MBCHARTBL) { - mbchar_table *mbt = (*((mbchar_table **) MuttVars[idx].data)); + struct MbCharTable *mbt = (*((struct MbCharTable **) MuttVars[idx].data)); val = mbt ? NONULL(mbt->orig_str) : ""; } else @@ -2586,8 +2586,8 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, s } else if (DTYPE(MuttVars[idx].type) == DT_MBCHARTBL) { - free_mbchar_table((mbchar_table **) MuttVars[idx].data); - *((mbchar_table **) MuttVars[idx].data) = parse_mbchar_table(tmp->data); + free_mbchar_table((struct MbCharTable **) MuttVars[idx].data); + *((struct MbCharTable **) MuttVars[idx].data) = parse_mbchar_table(tmp->data); } else { @@ -3635,7 +3635,7 @@ int var_to_string(int idx, char *val, size_t len) } else if (DTYPE(MuttVars[idx].type) == DT_MBCHARTBL) { - mbchar_table *mbt = (*((mbchar_table **) MuttVars[idx].data)); + struct MbCharTable *mbt = (*((struct MbCharTable **) MuttVars[idx].data)); strfcpy(tmp, mbt ? NONULL(mbt->orig_str) : "", sizeof(tmp)); } else if (DTYPE(MuttVars[idx].type) == DT_ADDR) diff --git a/mutt.h b/mutt.h index 9cf11508b..90b5d509d 100644 --- a/mutt.h +++ b/mutt.h @@ -1123,13 +1123,13 @@ typedef struct * Allows for direct access to the individual multibyte characters in a * string. This is used for the Flagchars, Fromchars, StChars and Tochars * option types. */ -typedef struct +struct MbCharTable { int len; /* number of characters */ char **chars; /* the array of multibyte character strings */ char *segmented_str; /* each chars entry points inside this string */ char *orig_str; -} mbchar_table; +}; #define MUTT_PARTS_TOPLEVEL (1 << 0) /* is the top-level part */ diff --git a/mutt_lua.c b/mutt_lua.c index f4906b602..defbe458a 100644 --- a/mutt_lua.c +++ b/mutt_lua.c @@ -204,7 +204,7 @@ static int _lua_mutt_get(lua_State *l) } case DT_MBCHARTBL: { - mbchar_table *tbl = *(mbchar_table **) opt->data; + struct MbCharTable *tbl = *(struct MbCharTable **) opt->data; lua_pushstring(l, tbl->orig_str); return 1; } -- 2.40.0