aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-07-03 13:17:37 +0200
committerGitHub <noreply@github.com>2023-07-03 13:17:37 +0200
commit5f442e1a4a831ed2eb70d5c2dd66c47b0b8aa7e1 (patch)
tree2c5ae2854f3688497b05f80bd0302feb9162a308 /src/nvim/eval
parentf771d6247147b393238fe57065a96fb5e9635358 (diff)
parentfcf3519c65a2d6736de437f686e788684a6c8564 (diff)
downloadrneovim-5f442e1a4a831ed2eb70d5c2dd66c47b0b8aa7e1.tar.gz
rneovim-5f442e1a4a831ed2eb70d5c2dd66c47b0b8aa7e1.tar.bz2
rneovim-5f442e1a4a831ed2eb70d5c2dd66c47b0b8aa7e1.zip
Merge pull request #23167 from dundargoc/refactor/long
refactor: remove long
Diffstat (limited to 'src/nvim/eval')
-rw-r--r--src/nvim/eval/buffer.c4
-rw-r--r--src/nvim/eval/funcs.c19
-rw-r--r--src/nvim/eval/window.c2
3 files changed, 13 insertions, 12 deletions
diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c
index aad88619b7..0fe3f5444c 100644
--- a/src/nvim/eval/buffer.c
+++ b/src/nvim/eval/buffer.c
@@ -126,7 +126,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, typval_
FUNC_ATTR_NONNULL_ARG(4, 5)
{
linenr_T lnum = lnum_arg + (append ? 1 : 0);
- long added = 0;
+ int added = 0;
// When using the current buffer ml_mfp will be set if needed. Useful when
// setline() is used on startup. For other buffers the buffer must be
@@ -442,7 +442,7 @@ void f_deletebufline(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (last > curbuf->b_ml.ml_line_count) {
last = curbuf->b_ml.ml_line_count;
}
- const long count = last - first + 1;
+ const int count = last - first + 1;
// When coming here from Insert mode, sync undo, so that this can be
// undone separately from what was previously inserted.
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f53c5fc0c5..f348a61075 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -886,7 +886,7 @@ static void f_copy(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "count()" function
static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- long n = 0;
+ varnumber_T n = 0;
int ic = 0;
bool error = false;
@@ -1085,8 +1085,9 @@ static void f_ctxsize(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// Otherwise use the column number as a byte offset.
static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
{
- long lnum, col;
- long coladd = 0;
+ linenr_T lnum;
+ colnr_T col;
+ colnr_T coladd = 0;
bool set_curswant = true;
rettv->vval.v_number = -1;
@@ -1114,12 +1115,12 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
} else if (lnum == 0) {
lnum = curwin->w_cursor.lnum;
}
- col = (long)tv_get_number_chk(&argvars[1], NULL);
+ col = (colnr_T)tv_get_number_chk(&argvars[1], NULL);
if (charcol) {
- col = buf_charidx_to_byteidx(curbuf, (linenr_T)lnum, (int)col) + 1;
+ col = buf_charidx_to_byteidx(curbuf, lnum, (int)col) + 1;
}
if (argvars[2].v_type != VAR_UNKNOWN) {
- coladd = (long)tv_get_number_chk(&argvars[2], NULL);
+ coladd = (colnr_T)tv_get_number_chk(&argvars[2], NULL);
}
} else {
emsg(_(e_invarg));
@@ -1129,12 +1130,12 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
return; // type error; errmsg already given
}
if (lnum > 0) {
- curwin->w_cursor.lnum = (linenr_T)lnum;
+ curwin->w_cursor.lnum = lnum;
}
if (col > 0) {
- curwin->w_cursor.col = (colnr_T)col - 1;
+ curwin->w_cursor.col = col - 1;
}
- curwin->w_cursor.coladd = (colnr_T)coladd;
+ curwin->w_cursor.coladd = coladd;
// Make sure the cursor is in a valid position.
check_cursor();
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index 30c295de46..26f5414565 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -266,7 +266,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
} else {
// Extract the window count (if specified). e.g. winnr('3j')
char *endp;
- long count = strtol(arg, &endp, 10);
+ int count = (int)strtol(arg, &endp, 10);
if (count <= 0) {
// if count is not specified, default to 1
count = 1;