aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-07 17:57:34 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-07 17:57:37 -0500
commitd34846af7455b8411476700920cdb64f121bae69 (patch)
tree16f255fcf66a50ceea661e08cbea7ce965c46e7c
parentb1df53e86884445d56a171eede5cf76138f2a4d3 (diff)
downloadrneovim-d34846af7455b8411476700920cdb64f121bae69.tar.gz
rneovim-d34846af7455b8411476700920cdb64f121bae69.tar.bz2
rneovim-d34846af7455b8411476700920cdb64f121bae69.zip
option: use char* for get_option_value() param
'name' param is casted to char_u* within get_option_value(). Most calls to get_option_value() cast arg to 'name' from char to char_u. Remove these pointless type casts.
-rw-r--r--src/nvim/context.c2
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/option.c8
-rw-r--r--src/nvim/spell.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/context.c b/src/nvim/context.c
index 1ae0510762..4162daa6ca 100644
--- a/src/nvim/context.c
+++ b/src/nvim/context.c
@@ -126,7 +126,7 @@ bool ctx_restore(Context *ctx, const int flags)
}
char_u *op_shada;
- get_option_value((char_u *)"shada", NULL, &op_shada, OPT_GLOBAL);
+ get_option_value("shada", NULL, &op_shada, OPT_GLOBAL);
set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL);
if (flags & kCtxRegs) {
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index fcf94bff89..d07618d2c0 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1848,7 +1848,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv,
s = tv_get_string_chk(tv); // != NULL if number or string.
}
if (s != NULL && op != NULL && *op != '=') {
- opt_type = get_option_value(arg, &numval, (char_u **)&stringval,
+ opt_type = get_option_value((char *)arg, &numval, (char_u **)&stringval,
opt_flags);
if ((opt_type == 1 && *op == '.')
|| (opt_type == 0 && *op != '.')) {
@@ -4537,7 +4537,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv,
c = *option_end;
*option_end = NUL;
- opt_type = get_option_value((char_u *)(*arg), &numval,
+ opt_type = get_option_value(*arg, &numval,
rettv == NULL ? NULL : &stringval, opt_flags);
if (opt_type == -3) { // invalid name
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 6af52645df..ac25c86b5f 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -4531,7 +4531,7 @@ bool is_tty_option(const char *name)
#define TCO_BUFFER_SIZE 8
/// @param name TUI-related option
/// @param[out,allocated] value option string value
-bool get_tty_option(char *name, char **value)
+bool get_tty_option(const char *name, char **value)
{
if (strequal(name, "t_Co")) {
if (value) {
@@ -4611,17 +4611,17 @@ static int findoption(const char *const arg)
/// hidden String option: -2.
/// unknown option: -3.
int get_option_value(
- char_u *name,
+ const char *name,
long *numval,
char_u **stringval, ///< NULL when only checking existence
int opt_flags
)
{
- if (get_tty_option((char *)name, (char **)stringval)) {
+ if (get_tty_option(name, (char **)stringval)) {
return 0;
}
- int opt_idx = findoption((const char *)name);
+ int opt_idx = findoption(name);
if (opt_idx < 0) { // Unknown option.
return -3;
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 6425c9fed5..fd1e01395a 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -6624,7 +6624,7 @@ void ex_spelldump(exarg_T *eap)
if (no_spell_checking(curwin)) {
return;
}
- get_option_value((char_u *)"spl", &dummy, &spl, OPT_LOCAL);
+ get_option_value("spl", &dummy, &spl, OPT_LOCAL);
// Create a new empty buffer in a new window.
do_cmdline_cmd("new");