aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorii14 <59243201+ii14@users.noreply.github.com>2023-04-07 19:39:04 +0200
committerGitHub <noreply@github.com>2023-04-07 19:39:04 +0200
commit1d2a29f75ba7d094c8e7444c9b249a4a7211c93c (patch)
tree6cfdf72d0751adf917426d242a532f0490990e9e /src
parentd675bd01b1e78b93e559320b262bdae40b3b54b2 (diff)
downloadrneovim-1d2a29f75ba7d094c8e7444c9b249a4a7211c93c.tar.gz
rneovim-1d2a29f75ba7d094c8e7444c9b249a4a7211c93c.tar.bz2
rneovim-1d2a29f75ba7d094c8e7444c9b249a4a7211c93c.zip
refactor: make char * parameters const in message.c
Add const to char * parameters in message.c functions and remove some redundant casts.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/vars.c2
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/highlight_group.c2
-rw-r--r--src/nvim/message.c28
-rw-r--r--src/nvim/os/env.c4
-rw-r--r--src/nvim/os/shell.c2
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/tag.c4
8 files changed, 23 insertions, 23 deletions
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 6252adf6a1..43847cb986 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -1206,7 +1206,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t
msg_putchar(' ');
}
- msg_outtrans((char *)string);
+ msg_outtrans(string);
if (type == VAR_FUNC || type == VAR_PARTIAL) {
msg_puts("()");
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 705f0fe83d..ace254c2c9 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4745,7 +4745,7 @@ void ex_oldfiles(exarg_T *eap)
if (!message_filtered(fname)) {
msg_outnum(nr);
msg_puts(": ");
- msg_outtrans((char *)tv_get_string(TV_LIST_ITEM_TV(li)));
+ msg_outtrans(tv_get_string(TV_LIST_ITEM_TV(li)));
msg_clr_eos();
msg_putchar('\n');
os_breakcheck();
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 5d9148e992..bc0f783095 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -1639,7 +1639,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg
msg_puts_attr(name, HL_ATTR(HLF_D));
msg_puts_attr("=", HL_ATTR(HLF_D));
}
- msg_outtrans((char *)ts);
+ msg_outtrans(ts);
}
return didh;
}
diff --git a/src/nvim/message.c b/src/nvim/message.c
index b43bc6ce9b..6524ae708e 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1488,17 +1488,17 @@ void msg_outnum(long n)
msg_puts(buf);
}
-void msg_home_replace(char *fname)
+void msg_home_replace(const char *fname)
{
msg_home_replace_attr(fname, 0);
}
-void msg_home_replace_hl(char *fname)
+void msg_home_replace_hl(const char *fname)
{
msg_home_replace_attr(fname, HL_ATTR(HLF_D));
}
-static void msg_home_replace_attr(char *fname, int attr)
+static void msg_home_replace_attr(const char *fname, int attr)
{
char *name = home_replace_save(NULL, fname);
msg_outtrans_attr(name, attr);
@@ -1510,7 +1510,7 @@ static void msg_home_replace_attr(char *fname, int attr)
/// Use attributes 'attr'.
///
/// @return the number of characters it takes on the screen.
-int msg_outtrans(char *str)
+int msg_outtrans(const char *str)
{
return msg_outtrans_attr(str, 0);
}
@@ -1529,7 +1529,7 @@ int msg_outtrans_len(const char *str, int len)
/// Handles multi-byte characters.
///
/// @return pointer to the next character.
-char *msg_outtrans_one(char *p, int attr)
+const char *msg_outtrans_one(const char *p, int attr)
{
int l;
@@ -1616,11 +1616,11 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr)
return retval;
}
-void msg_make(char *arg)
+void msg_make(const char *arg)
{
int i;
- static char *str = "eeffoc";
- static char *rs = "Plon#dqg#vxjduB";
+ static const char *str = "eeffoc";
+ static const char *rs = "Plon#dqg#vxjduB";
arg = skipwhite(arg);
for (i = 5; *arg && i >= 0; i--) {
@@ -1806,20 +1806,20 @@ void str2specialbuf(const char *sp, char *buf, size_t len)
}
/// print line for :print or :list command
-void msg_prt_line(char *s, int list)
+void msg_prt_line(const char *s, int list)
{
int c;
int col = 0;
int n_extra = 0;
int c_extra = 0;
int c_final = 0;
- char *p_extra = NULL; // init to make SASC shut up
+ const char *p_extra = NULL; // init to make SASC shut up
int n;
int attr = 0;
- char *lead = NULL;
+ const char *lead = NULL;
bool in_multispace = false;
int multispace_pos = 0;
- char *trail = NULL;
+ const char *trail = NULL;
int l;
if (curwin->w_p_list) {
@@ -2011,12 +2011,12 @@ void msg_puts_title(const char *s)
/// Show a message in such a way that it always fits in the line. Cut out a
/// part in the middle and replace it with "..." when necessary.
/// Does not handle multi-byte characters!
-void msg_outtrans_long_attr(char *longstr, int attr)
+void msg_outtrans_long_attr(const char *longstr, int attr)
{
msg_outtrans_long_len_attr(longstr, (int)strlen(longstr), attr);
}
-void msg_outtrans_long_len_attr(char *longstr, int len, int attr)
+void msg_outtrans_long_len_attr(const char *longstr, int len, int attr)
{
int slen = len;
int room;
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 5b8c060e7a..b167bf02fd 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -1060,7 +1060,7 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si
}
if (buf != NULL && buf->b_help) {
- const size_t dlen = xstrlcpy(dst, path_tail((char *)src), dstlen);
+ const size_t dlen = xstrlcpy(dst, path_tail(src), dstlen);
return MIN(dlen, dstlen - 1);
}
@@ -1098,7 +1098,7 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si
}
if (!one) {
- src = skipwhite((char *)src);
+ src = skipwhite(src);
}
char *dst_p = dst;
while (*src && dstlen > 0) {
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index f7d1154169..e990db3296 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -876,7 +876,7 @@ static int do_os_system(char **argv, const char *input, size_t len, char **outpu
// Failed, probably 'shell' is not executable.
if (!silent) {
msg_puts(_("\nshell failed to start: "));
- msg_outtrans((char *)os_strerror(status));
+ msg_outtrans(os_strerror(status));
msg_puts(": ");
msg_outtrans(prog);
msg_putchar('\n');
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index c0bb7d726e..6b8cce4858 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3643,7 +3643,7 @@ static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_
prev_skipempty = (kp->flags & HL_SKIPEMPTY);
}
}
- msg_outtrans((char *)kp->keyword);
+ msg_outtrans(kp->keyword);
}
}
}
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index a9ef884214..a00112c126 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -795,8 +795,8 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
{
taggy_T *tagstack = curwin->w_tagstack;
int tagstackidx = curwin->w_tagstackidx;
- char *p;
- char *command_end;
+ const char *p;
+ const char *command_end;
tagptrs_T tagp;
int taglen;
int attr;