mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
refactor: make char * parameters const in message.c
Add const to char * parameters in message.c functions and remove some redundant casts.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user