aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2021-10-07 11:17:02 +0200
committerDundar Göc <gocdundar@gmail.com>2021-10-07 13:16:55 +0200
commit6d9dea42012fa9ae42832f12c9fd457003cb196f (patch)
tree1aecf23386c01c10856489158e1f8ba798377356
parentc61a3865eea21f87ac17719ba226ad556b5a11a6 (diff)
downloadrneovim-6d9dea42012fa9ae42832f12c9fd457003cb196f.tar.gz
rneovim-6d9dea42012fa9ae42832f12c9fd457003cb196f.tar.bz2
rneovim-6d9dea42012fa9ae42832f12c9fd457003cb196f.zip
refactor: remove redundant casts
-rw-r--r--src/nvim/api/buffer.c8
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/channel.c4
-rw-r--r--src/nvim/eval/funcs.c12
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/extmark.c2
-rw-r--r--src/nvim/if_cscope.c6
-rw-r--r--src/nvim/marktree.c4
-rw-r--r--src/nvim/menu.c2
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/spell.c4
-rw-r--r--src/nvim/terminal.c2
14 files changed, 27 insertions, 27 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 3ab7e6b778..5c7190426b 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -418,7 +418,7 @@ void nvim_buf_set_lines(uint64_t channel_id, Buffer buffer, Integer start, Integ
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
if (!MODIFIABLE(buf)) {
api_set_error(err, kErrorTypeException, "Buffer is not 'modifiable'");
@@ -656,7 +656,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
if (!MODIFIABLE(buf)) {
api_set_error(err, kErrorTypeException, "Buffer is not 'modifiable'");
@@ -1340,7 +1340,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
if (extmark.row < 0) {
return rv;
}
- return extmark_to_array(extmark, false, (bool)details);
+ return extmark_to_array(extmark, false, details);
}
/// Gets extmarks in "traversal order" from a |charwise| region defined by
@@ -1983,7 +1983,7 @@ Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
}
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
Array args = ARRAY_DICT_INIT;
Object res = nlua_call_ref(fun, NULL, args, true, err);
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 4ac5edeaa9..7f702d888e 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -625,7 +625,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
// Copy bytes before the cursor.
if (col > 0) {
- memmove(newp, oldp, (size_t)col);
+ memmove(newp, oldp, col);
}
// Copy bytes after the changed character(s).
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index 30243a3102..db0a2ff64c 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -87,7 +87,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
break;
case kChannelStreamProc:
- proc = (Process *)&chan->stream.proc;
+ proc = &chan->stream.proc;
if (part == kChannelPartStdin || close_main) {
stream_may_close(&proc->in);
}
@@ -335,7 +335,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader
chan->stream.uv = libuv_process_init(&main_loop, chan);
}
- Process *proc = (Process *)&chan->stream.proc;
+ Process *proc = &chan->stream.proc;
proc->argv = argv;
proc->cb = channel_process_exit_cb;
proc->events = chan->events;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 50e0b0b258..71ad0b7369 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -3741,7 +3741,7 @@ static void f_getmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (cur->conceal_char) {
char buf[MB_MAXBYTES + 1];
- buf[utf_char2bytes((int)cur->conceal_char, (char_u *)buf)] = NUL;
+ buf[utf_char2bytes(cur->conceal_char, (char_u *)buf)] = NUL;
tv_dict_add_str(dict, S_LEN("conceal"), buf);
}
@@ -5230,7 +5230,7 @@ static void f_jobpid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- Process *proc = (Process *)&data->stream.proc;
+ Process *proc = &data->stream.proc;
rettv->vval.v_number = proc->pid;
}
@@ -5528,7 +5528,7 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Ignore return code, but show error later.
(void)channel_close(data->id, kChannelPartRpc, &error);
}
- process_stop((Process *)&data->stream.proc);
+ process_stop(&data->stream.proc);
rettv->vval.v_number = 1;
if (error) {
EMSG(error);
@@ -6135,7 +6135,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
}
}
- match = vim_regexec_nl(&regmatch, str, (colnr_T)startcol);
+ match = vim_regexec_nl(&regmatch, str, startcol);
if (match && --nth <= 0) {
break;
@@ -6346,7 +6346,7 @@ static void f_matcharg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
: 0));
if (id >= 1 && id <= 3) {
- matchitem_T *const m = (matchitem_T *)get_match(curwin, id);
+ matchitem_T *const m = get_match(curwin, id);
if (m != NULL) {
tv_list_append_string(rettv->vval.v_list,
@@ -6993,7 +6993,7 @@ static void f_range(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else {
tv_list_alloc_ret(rettv, (end - start) / stride);
for (i = start; stride > 0 ? i <= end : i >= end; i += stride) {
- tv_list_append_number(rettv->vval.v_list, (varnumber_T)i);
+ tv_list_append_number(rettv->vval.v_list, i);
}
}
}
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 4c8789964f..cfc95ba167 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -2861,7 +2861,7 @@ bool tv_equal(typval_T *const tv1, typval_T *const tv2, const bool ic, const boo
char buf2[NUMBUFLEN];
const char *s1 = tv_get_string_buf(tv1, buf1);
const char *s2 = tv_get_string_buf(tv2, buf2);
- return mb_strcmp_ic((bool)ic, s1, s2) == 0;
+ return mb_strcmp_ic(ic, s1, s2) == 0;
}
case VAR_BOOL:
return tv1->vval.v_bool == tv2->vval.v_bool;
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index cf01c305d7..dc73e34111 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -723,7 +723,7 @@ void extmark_move_region(buf_T *buf, int start_row, colnr_T start_col, bcount_t
uint64_t src2ns(Integer *src_id)
{
if (*src_id == 0) {
- *src_id = (Integer)nvim_create_namespace((String)STRING_INIT);
+ *src_id = nvim_create_namespace((String)STRING_INIT);
}
if (*src_id < 0) {
return UINT64_MAX;
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 76dcb58236..f236b966ca 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1294,7 +1294,7 @@ static int cs_kill(exarg_T *eap)
}
}
} else {
- cs_kill_execute((size_t)i, stok);
+ cs_kill_execute(i, stok);
}
}
@@ -1559,8 +1559,8 @@ static void cs_fill_results(char *tagstr, size_t totmatches, int *nummatches_a,
assert(totmatches > 0);
buf = xmalloc(CSREAD_BUFSIZE);
- matches = xmalloc(sizeof(char *) * (size_t)totmatches);
- cntxts = xmalloc(sizeof(char *) * (size_t)totmatches);
+ matches = xmalloc(sizeof(char *) * totmatches);
+ cntxts = xmalloc(sizeof(char *) * totmatches);
for (size_t i = 0; i < csinfo_size; i++) {
if (nummatches_a[i] < 1) {
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index ebe4478bc8..e62f91e698 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -837,8 +837,8 @@ bool marktree_splice(MarkTree *b, int start_line, int start_col, int old_extent_
int old_extent_col, int new_extent_line, int new_extent_col)
{
mtpos_t start = { start_line, start_col };
- mtpos_t old_extent = { (int)old_extent_line, old_extent_col };
- mtpos_t new_extent = { (int)new_extent_line, new_extent_col };
+ mtpos_t old_extent = { old_extent_line, old_extent_col };
+ mtpos_t new_extent = { new_extent_line, new_extent_col };
bool may_delete = (old_extent.row != 0 || old_extent.col != 0);
bool same_line = old_extent.row == 0 && new_extent.row == 0;
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index de8503f9d0..85e062009a 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -857,7 +857,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
MSG_PUTS(" ");
}
if (menu->priority) {
- msg_outnum((long)menu->priority);
+ msg_outnum(menu->priority);
MSG_PUTS(" ");
}
// Same highlighting as for directories!?
diff --git a/src/nvim/message.c b/src/nvim/message.c
index edde51e770..cc4319b8da 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2363,7 +2363,7 @@ void msg_reset_scroll(void)
// non-displayed part of msg_grid is considered invalid.
for (int i = 0; i < MIN(msg_scrollsize(), msg_grid.Rows); i++) {
grid_clear_line(&msg_grid, msg_grid.line_offset[i],
- (int)msg_grid.Columns, false);
+ msg_grid.Columns, false);
}
}
} else {
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 5646a62cd4..b60699b66f 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3899,7 +3899,7 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va
// when 'buflisted' changes, trigger autocommands
apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
NULL, NULL, true, curbuf);
- } else if ((int *)varp == (int *)&curbuf->b_p_swf) {
+ } else if ((int *)varp == &curbuf->b_p_swf) {
// when 'swf' is set, create swapfile, when reset remove swapfile
if (curbuf->b_p_swf && p_uc) {
ml_open_file(curbuf); // create the swap file
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 0cec28c4de..2610df666b 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -2401,7 +2401,7 @@ static inline void shada_initialize_registers(WriteMergerState *const wms, int m
.data = {
.reg = {
.contents = (char **)reg.y_array,
- .contents_size = (size_t)reg.y_size,
+ .contents_size = reg.y_size,
.type = reg.y_type,
.width = (size_t)(reg.y_type == kMTBlockWise ? reg.y_width : 0),
.additional_data = reg.additional_data,
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 450ec891ad..9ed421c8a0 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2924,8 +2924,8 @@ void spell_suggest(int count)
// Get the list of suggestions. Limit to 'lines' - 2 or the number in
// 'spellsuggest', whatever is smaller.
- if (sps_limit > (int)Rows - 2) {
- limit = (int)Rows - 2;
+ if (sps_limit > Rows - 2) {
+ limit = Rows - 2;
} else {
limit = sps_limit;
}
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 07d668ba5b..fb025265f2 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1241,7 +1241,7 @@ static bool send_mouse_event(Terminal *term, int c)
mouse_action(term, button, row, col - offset, drag, 0);
size_t len = vterm_output_read(term->vt, term->textbuf,
sizeof(term->textbuf));
- terminal_send(term, term->textbuf, (size_t)len);
+ terminal_send(term, term->textbuf, len);
return false;
}