mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
refactor: remove redundant const char * casts
This commit is contained in:
@@ -910,7 +910,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
||||
}
|
||||
const char *insp = NULL;
|
||||
const char *after_insp = NULL;
|
||||
for (const char *entry = (const char *)p_rtp; *entry != NUL;) {
|
||||
for (const char *entry = p_rtp; *entry != NUL;) {
|
||||
const char *cur_entry = entry;
|
||||
|
||||
copy_option_part((char **)&entry, buf, MAXPATHL, ",");
|
||||
@@ -945,7 +945,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
||||
|
||||
if (insp == NULL) {
|
||||
// Both "fname" and "after" not found, append at the end.
|
||||
insp = (const char *)p_rtp + strlen(p_rtp);
|
||||
insp = p_rtp + strlen(p_rtp);
|
||||
}
|
||||
|
||||
// check if rtp/pack/name/start/name/after exists
|
||||
@@ -966,7 +966,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
||||
|
||||
// We now have 'rtp' parts: {keep}{keep_after}{rest}.
|
||||
// Create new_rtp, first: {keep},{fname}
|
||||
size_t keep = (size_t)(insp - (const char *)p_rtp);
|
||||
size_t keep = (size_t)(insp - p_rtp);
|
||||
memmove(new_rtp, p_rtp, keep);
|
||||
size_t new_rtp_len = keep;
|
||||
if (*insp == NUL) {
|
||||
@@ -979,7 +979,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
||||
}
|
||||
|
||||
if (afterlen > 0 && after_insp != NULL) {
|
||||
size_t keep_after = (size_t)(after_insp - (const char *)p_rtp);
|
||||
size_t keep_after = (size_t)(after_insp - p_rtp);
|
||||
|
||||
// Add to new_rtp: {keep},{fname}{keep_after},{afterdir}
|
||||
memmove(new_rtp + new_rtp_len, p_rtp + keep, keep_after - keep);
|
||||
@@ -1061,7 +1061,7 @@ static void add_pack_plugin(bool opt, char *fname, void *cookie)
|
||||
char *buf = xmalloc(MAXPATHL);
|
||||
bool found = false;
|
||||
|
||||
const char *p = (const char *)p_rtp;
|
||||
const char *p = p_rtp;
|
||||
while (*p != NUL) {
|
||||
copy_option_part((char **)&p, buf, MAXPATHL, ",");
|
||||
if (path_fnamecmp(buf, fname) == 0) {
|
||||
@@ -1925,12 +1925,10 @@ static void cmd_source_buffer(const exarg_T *const eap)
|
||||
.offset = 0,
|
||||
};
|
||||
if (curbuf->b_fname
|
||||
&& path_with_extension((const char *)curbuf->b_fname, "lua")) {
|
||||
nlua_source_using_linegetter(get_str_line, (void *)&cookie,
|
||||
":source (no file)");
|
||||
&& path_with_extension(curbuf->b_fname, "lua")) {
|
||||
nlua_source_using_linegetter(get_str_line, (void *)&cookie, ":source (no file)");
|
||||
} else {
|
||||
source_using_linegetter((void *)&cookie, get_str_line,
|
||||
":source (no file)");
|
||||
source_using_linegetter((void *)&cookie, get_str_line, ":source (no file)");
|
||||
}
|
||||
ga_clear(&ga);
|
||||
}
|
||||
@@ -2134,12 +2132,12 @@ int do_source(char *fname, int check_other, int is_vimrc, int *ret_sid)
|
||||
|
||||
cookie.conv.vc_type = CONV_NONE; // no conversion
|
||||
|
||||
if (path_with_extension((const char *)fname_exp, "lua")) {
|
||||
if (path_with_extension(fname_exp, "lua")) {
|
||||
const sctx_T current_sctx_backup = current_sctx;
|
||||
current_sctx.sc_sid = SID_LUA;
|
||||
current_sctx.sc_lnum = 0;
|
||||
// Source the file as lua
|
||||
nlua_exec_file((const char *)fname_exp);
|
||||
nlua_exec_file(fname_exp);
|
||||
current_sctx = current_sctx_backup;
|
||||
} else {
|
||||
// Read the first line so we can check for a UTF-8 BOM.
|
||||
|
Reference in New Issue
Block a user