From 7a2fcbbbecc96c0179aa9449a1d4e3b5d936a054 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Thu, 14 Apr 2022 12:37:17 +0200 Subject: refactor: replace char_u variables and functions with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/buffer_defs.h | 12 +-- src/nvim/eval/funcs.c | 4 +- src/nvim/ex_docmd.c | 5 +- src/nvim/menu.c | 230 ++++++++++++++++++++++++------------------------- src/nvim/screen.c | 4 +- 5 files changed, 127 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 375bebc5ac..298bec808c 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1148,15 +1148,15 @@ typedef struct VimMenu vimmenu_T; struct VimMenu { int modes; ///< Which modes is this menu visible for int enabled; ///< for which modes the menu is enabled - char_u *name; ///< Name of menu, possibly translated - char_u *dname; ///< Displayed Name ("name" without '&') - char_u *en_name; ///< "name" untranslated, NULL when + char *name; ///< Name of menu, possibly translated + char *dname; ///< Displayed Name ("name" without '&') + char *en_name; ///< "name" untranslated, NULL when ///< was not translated - char_u *en_dname; ///< NULL when "dname" untranslated + char *en_dname; ///< NULL when "dname" untranslated int mnemonic; ///< mnemonic key (after '&') - char_u *actext; ///< accelerator text (after TAB) + char *actext; ///< accelerator text (after TAB) long priority; ///< Menu order priority - char_u *strings[MENU_MODES]; ///< Mapped string for each mode + char *strings[MENU_MODES]; ///< Mapped string for each mode int noremap[MENU_MODES]; ///< A \ref REMAP_VALUES flag for each mode bool silent[MENU_MODES]; ///< A silent flag for each mode vimmenu_T *children; ///< Children of sub-menu diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 609db3990b..5d192eb4b3 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2182,7 +2182,7 @@ static void f_menu_get(typval_T *argvars, typval_T *rettv, FunPtr fptr) const char *const strmodes = tv_get_string(&argvars[1]); modes = get_menu_cmd_modes(strmodes, false, NULL, NULL); } - menu_get((char_u *)tv_get_string(&argvars[0]), modes, rettv->vval.v_list); + menu_get((char *)tv_get_string(&argvars[0]), modes, rettv->vval.v_list); } /// "expandcmd()" function @@ -3256,7 +3256,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr) } if (xpc.xp_context == EXPAND_MENUS) { - set_context_in_menu_cmd(&xpc, "menu", xpc.xp_pattern, false); + set_context_in_menu_cmd(&xpc, "menu", (char *)xpc.xp_pattern, false); xpc.xp_pattern_len = STRLEN(xpc.xp_pattern); } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index cbfe6e3789..4ffed77c14 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3610,8 +3610,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) // EX_XFILE: file names are handled above. if (!(ea.argt & EX_XFILE)) { if (context == EXPAND_MENUS) { - return (const char *)set_context_in_menu_cmd(xp, cmd, - (char_u *)arg, forceit); + return (const char *)set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit); } else if (context == EXPAND_COMMANDS) { return arg; } else if (context == EXPAND_MAPPINGS) { @@ -3717,7 +3716,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_tunmenu: case CMD_popup: case CMD_emenu: - return (const char *)set_context_in_menu_cmd(xp, cmd, (char_u *)arg, forceit); + return (const char *)set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit); case CMD_colorscheme: xp->xp_context = EXPAND_COLORS; diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 0db9d69a7e..0af39b0b0b 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -38,20 +38,20 @@ /// The character for each menu mode -static char_u menu_mode_chars[] = { 'n', 'v', 's', 'o', 'i', 'c', 't' }; +static char menu_mode_chars[] = { 'n', 'v', 's', 'o', 'i', 'c', 't' }; -static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu"); -static char_u e_othermode[] = N_("E328: Menu only exists in another mode"); -static char_u e_nomenu[] = N_("E329: No menu \"%s\""); +static char e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu"); +static char e_othermode[] = N_("E328: Menu only exists in another mode"); +static char e_nomenu[] = N_("E329: No menu \"%s\""); // Return true if "name" is a window toolbar menu name. -static bool menu_is_winbar(const char_u *const name) +static bool menu_is_winbar(const char *const name) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { return (STRNCMP(name, "WinBar", 6) == 0); } -static vimmenu_T **get_root_menu(const char_u *const name) +static vimmenu_T **get_root_menu(const char *const name) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { return &root_menu; @@ -63,13 +63,13 @@ void ex_menu(exarg_T *eap) { char *menu_path; int modes; - char_u *map_to; // command mapped to the menu entry + char *map_to; // command mapped to the menu entry int noremap; bool silent = false; int unmenu; - char_u *map_buf; - char_u *arg; - char_u *p; + char *map_buf; + char *arg; + char *p; int i; long pri_tab[MENUDEPTH + 1]; TriState enable = kNone; // kTrue for "menu enable", @@ -77,22 +77,22 @@ void ex_menu(exarg_T *eap) vimmenu_T menuarg; modes = get_menu_cmd_modes((char *)eap->cmd, eap->forceit, &noremap, &unmenu); - arg = eap->arg; + arg = (char *)eap->arg; for (;;) { if (STRNCMP(arg, "