From: Richard Russon Date: Fri, 1 Sep 2017 19:46:23 +0000 (+0100) Subject: rename: Unify the multi-byte char table naming X-Git-Tag: neomutt-20170907~4^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e8dccecfe9494e01daf959800cd0de0d9348771;p=neomutt rename: Unify the multi-byte char table naming Through the code this was referred to by the names: - mbchar_table - mbyte_table - mbchartbl --- diff --git a/ChangeLog.md b/ChangeLog.md index 4afc8dc4c..445ff2f0d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -647,7 +647,7 @@ - Rework OpenSSL certificate verification to support alternative chains. (closes #3903) - Add option to control whether threads uncollapse when new mail arrives. - In the manual, replaced 2 para by example (similar to the first example). - - Create mbchar_table type for multibyte character arrays. (see #3024) + - Create MbTable type for multibyte character arrays. (see #3024) - Make to_chars and status_chars accept mulitibyte characters. (closes #3024) 2016-11-26 Richard Russon diff --git a/Makefile.am b/Makefile.am index fc4742bb1..ac3a2f0e2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,7 @@ mutt_SOURCES = account.c addrbook.c address.h alias.c alias.h attach.c \ curs_lib.c curs_main.c edit.c editmsg.c enter.c enter_state.h \ envelope.c envelope.h filter.c flags.c format_flags.h from.c getdomain.c group.c \ handler.c hdrline.c header.h headers.c help.c history.c hook.c \ - init.c keymap.c list.h main.c mbox.c mbyte.c mbyte_table.h \ + init.c keymap.c list.h main.c mbox.c mbyte.c mbtable.h \ menu.c mh.c muttlib.c mutt_idna.c mutt_sasl_plain.c mutt_socket.c \ mutt_tunnel.c mx.c newsrc.c nntp.c options.h pager.c parameter.c parameter.h \ parse.c pattern.c pattern.h pop.c pop_auth.c pop_lib.c postpone.c \ diff --git a/contrib/lua/test_lua-api_spec.lua b/contrib/lua/test_lua-api_spec.lua index 6ad7a1754..70619f5a7 100644 --- a/contrib/lua/test_lua-api_spec.lua +++ b/contrib/lua/test_lua-api_spec.lua @@ -76,7 +76,7 @@ describe('lua API', function() test_config_type("mask", "!^\\\\.[^.]", ".*") end) - it('works with DT_MBCHARTBL', function() + it('works with DT_MBTABLE', function() test_config_type("to_chars", "+TCFL", "+T") end) diff --git a/globals.h b/globals.h index e5eebf208..73054811d 100644 --- a/globals.h +++ b/globals.h @@ -71,7 +71,7 @@ WHERE char *ForwardAttrIntro; WHERE char *ForwardAttrTrailer; WHERE char *ForwFmt; WHERE char *Fqdn; -WHERE struct MbCharTable *FromChars; +WHERE struct MbTable *FromChars; WHERE char *HdrFmt; WHERE char *HistFile; WHERE char *HomeDir; @@ -178,11 +178,11 @@ WHERE short SslDHPrimeBits; WHERE char *SslCACertFile; #endif #endif -WHERE struct MbCharTable *StChars; +WHERE struct MbTable *StChars; WHERE char *Status; WHERE char *TempDir; -WHERE struct MbCharTable *ToChars; -WHERE struct MbCharTable *FlagChars; +WHERE struct MbTable *ToChars; +WHERE struct MbTable *FlagChars; WHERE char *TrashPath; WHERE char *TSStatusFormat; WHERE char *TSIconFormat; diff --git a/hdrline.c b/hdrline.c index a5b1f5f0d..f9360c595 100644 --- a/hdrline.c +++ b/hdrline.c @@ -39,7 +39,7 @@ #include "globals.h" #include "header.h" #include "lib/lib.h" -#include "mbyte_table.h" +#include "mbtable.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "ncrypt/ncrypt.h" @@ -205,7 +205,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(struct MbCharTable *table, int index) +static char *get_nth_wchar(struct MbTable *table, int index) { if (!table || !table->chars || (index < 0) || (index >= table->len)) return " "; diff --git a/init.c b/init.c index 1432ee6c3..1b489809f 100644 --- a/init.c +++ b/init.c @@ -54,7 +54,7 @@ #include "list.h" #include "mailbox.h" #include "mbyte.h" -#include "mbyte_table.h" +#include "mbtable.h" #include "mutt.h" #include "mutt_curses.h" #include "mutt_idna.h" @@ -283,7 +283,7 @@ bool mutt_option_get(const char *s, struct Option *opt) } #endif -static void free_mbchar_table(struct MbCharTable **t) +static void free_mbtable(struct MbTable **t) { if (!t || !*t) return; @@ -294,14 +294,14 @@ static void free_mbchar_table(struct MbCharTable **t) FREE(t); } -static struct MbCharTable *parse_mbchar_table(const char *s) +static struct MbTable *parse_mbtable(const char *s) { - struct MbCharTable *t = NULL; + struct MbTable *t = NULL; size_t slen, k; mbstate_t mbstate; char *d = NULL; - t = safe_calloc(1, sizeof(struct MbCharTable)); + t = safe_calloc(1, sizeof(struct MbTable)); slen = mutt_strlen(s); if (!slen) return t; @@ -318,7 +318,7 @@ static struct MbCharTable *parse_mbchar_table(const char *s) if (k == (size_t)(-1) || k == (size_t)(-2)) { mutt_debug( - 1, "parse_mbchar_table: mbrtowc returned %d converting %s in %s\n", + 1, "parse_mbtable: mbrtowc returned %d converting %s in %s\n", (k == (size_t)(-1)) ? -1 : -2, s, t->orig_str); if (k == (size_t)(-1)) memset(&mbstate, 0, sizeof(mbstate)); @@ -452,9 +452,9 @@ int mutt_option_set(const struct Option *val, struct Buffer *err) break; case DT_MBTABLE: { - struct MbCharTable **tbl = (struct MbCharTable **) MuttVars[idx].data; - free_mbchar_table(tbl); - *tbl = parse_mbchar_table((const char *) val->data); + struct MbTable **tbl = (struct MbTable **) MuttVars[idx].data; + free_mbtable(tbl); + *tbl = parse_mbtable((const char *) val->data); } break; case DT_ADDRESS: @@ -2083,8 +2083,8 @@ static void restore_default(struct Option *p) mutt_str_replace((char **) p->data, (char *) p->init); break; case DT_MBTABLE: - free_mbchar_table((struct MbCharTable **) p->data); - *((struct MbCharTable **) p->data) = parse_mbchar_table((char *) p->init); + free_mbtable((struct MbTable **) p->data); + *((struct MbTable **) p->data) = parse_mbtable((char *) p->init); break; case DT_PATH: FREE((char **) p->data); @@ -2646,7 +2646,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, else if (DTYPE(MuttVars[idx].type) == DT_ADDRESS) rfc822_free_address((struct Address **) MuttVars[idx].data); else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE) - free_mbchar_table((struct MbCharTable **) MuttVars[idx].data); + free_mbtable((struct MbTable **) MuttVars[idx].data); else /* MuttVars[idx].data is already 'char**' (or some 'void**') or... * so cast to 'void*' is okay */ @@ -2686,7 +2686,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, } else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE) { - struct MbCharTable *mbt = (*((struct MbCharTable **) MuttVars[idx].data)); + struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].data)); val = mbt ? NONULL(mbt->orig_str) : ""; } else @@ -2768,8 +2768,8 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, } else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE) { - free_mbchar_table((struct MbCharTable **) MuttVars[idx].data); - *((struct MbCharTable **) MuttVars[idx].data) = parse_mbchar_table(tmp->data); + free_mbtable((struct MbTable **) MuttVars[idx].data); + *((struct MbTable **) MuttVars[idx].data) = parse_mbtable(tmp->data); } else { @@ -3852,7 +3852,7 @@ int var_to_string(int idx, char *val, size_t len) } else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE) { - struct MbCharTable *mbt = (*((struct MbCharTable **) MuttVars[idx].data)); + struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].data)); strfcpy(tmp, mbt ? NONULL(mbt->orig_str) : "", sizeof(tmp)); } else if (DTYPE(MuttVars[idx].type) == DT_ADDRESS) diff --git a/mbyte_table.h b/mbtable.h similarity index 88% rename from mbyte_table.h rename to mbtable.h index 42cc4ba2d..d8ac109e8 100644 --- a/mbyte_table.h +++ b/mbtable.h @@ -20,17 +20,17 @@ * this program. If not, see . */ -#ifndef _MUTT_MBYTE_TABLE_H -#define _MUTT_MBYTE_TABLE_H +#ifndef _MUTT_MBTABLE_H +#define _MUTT_MBTABLE_H /** - * struct MbCharTable - multibyte character table + * struct MbTable - multibyte character table * * Allows for direct access to the individual multibyte characters in a * string. This is used for the FlagChars, FromChars, StChars and ToChars * option types. */ -struct MbCharTable +struct MbTable { int len; /**< number of characters */ char **chars; /**< the array of multibyte character strings */ @@ -38,4 +38,4 @@ struct MbCharTable char *orig_str; }; -#endif /* _MUTT_MBYTE_TABLE_H */ +#endif /* _MUTT_MBTABLE_H */ diff --git a/mutt_lua.c b/mutt_lua.c index d23a307b1..7c7d6166d 100644 --- a/mutt_lua.c +++ b/mutt_lua.c @@ -34,7 +34,7 @@ #include "globals.h" #include "lib/lib.h" #include "mailbox.h" -#include "mbyte_table.h" +#include "mbtable.h" #include "mutt_commands.h" #include "mutt_options.h" #include "options.h" @@ -211,7 +211,7 @@ static int _lua_mutt_get(lua_State *l) } case DT_MBTABLE: { - struct MbCharTable *tbl = *(struct MbCharTable **) opt.data; + struct MbTable *tbl = *(struct MbTable **) opt.data; lua_pushstring(l, tbl->orig_str); return 1; } diff --git a/status.c b/status.c index 7c4188567..d7fa3039f 100644 --- a/status.c +++ b/status.c @@ -26,7 +26,7 @@ #include "format_flags.h" #include "globals.h" #include "lib/lib.h" -#include "mbyte_table.h" +#include "mbtable.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "mx.h"