diff options
author | ii14 <59243201+ii14@users.noreply.github.com> | 2023-04-07 19:40:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 19:40:57 +0200 |
commit | 9408f2dcf7cade2631688300e9b58eed6bc5219a (patch) | |
tree | 152b8b6135f50619b1fb2a69719d71a180ea0792 /src/nvim/runtime.c | |
parent | 1d2a29f75ba7d094c8e7444c9b249a4a7211c93c (diff) | |
download | rneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.tar.gz rneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.tar.bz2 rneovim-9408f2dcf7cade2631688300e9b58eed6bc5219a.zip |
refactor: remove redundant const char * casts
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 5d1c104dc5..c02e12ae61 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -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. |