aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-09-29 14:58:48 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-10-09 11:45:46 +0200
commit8e932480f61d6101bf8bea1abc07ed93826221fd (patch)
tree06cf8d0af6e786aba6d01343c54ba52b01738daa /src/nvim/fold.c
parentdacd34364ff3af98bc2d357c43e3ce06638e2ce9 (diff)
downloadrneovim-8e932480f61d6101bf8bea1abc07ed93826221fd.tar.gz
rneovim-8e932480f61d6101bf8bea1abc07ed93826221fd.tar.bz2
rneovim-8e932480f61d6101bf8bea1abc07ed93826221fd.zip
refactor: the long goodbye
long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 6a9dbe9edc..2e38f9ca3d 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -363,7 +363,7 @@ int foldmethodIsDiff(win_T *wp)
// closeFold() {{{2
/// Close fold for current window at position "pos".
/// Repeat "count" times.
-void closeFold(pos_T pos, long count)
+void closeFold(pos_T pos, int count)
{
setFoldRepeat(pos, count, false);
}
@@ -417,7 +417,7 @@ void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int ha
// openFold() {{{2
/// Open fold for current window at position "pos".
/// Repeat "count" times.
-void openFold(pos_T pos, long count)
+void openFold(pos_T pos, int count)
{
setFoldRepeat(pos, count, true);
}
@@ -847,7 +847,7 @@ void foldUpdateAll(win_T *win)
/// @return FAIL if not moved.
///
/// @param dir FORWARD or BACKWARD
-int foldMoveTo(const bool updown, const int dir, const long count)
+int foldMoveTo(const bool updown, const int dir, const int count)
{
int retval = FAIL;
linenr_T lnum;
@@ -856,7 +856,7 @@ int foldMoveTo(const bool updown, const int dir, const long count)
checkupdate(curwin);
// Repeat "count" times.
- for (long n = 0; n < count; n++) {
+ for (int n = 0; n < count; n++) {
// Find nested folds. Stop when a fold is closed. The deepest fold
// that moves the cursor is used.
linenr_T lnum_off = 0;
@@ -1136,7 +1136,7 @@ static void checkupdate(win_T *wp)
// setFoldRepeat() {{{2
/// Open or close fold for current window at position `pos`.
/// Repeat "count" times.
-static void setFoldRepeat(pos_T pos, long count, int do_open)
+static void setFoldRepeat(pos_T pos, int count, int do_open)
{
for (int n = 0; n < count; n++) {
int done = DONE_NOTHING;
@@ -1816,11 +1816,11 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
}
}
if (text == NULL) {
- long count = lnume - lnum + 1;
+ int count = lnume - lnum + 1;
vim_snprintf(buf, FOLD_TEXT_LEN,
- NGETTEXT("+--%3ld line folded",
- "+--%3ld lines folded ", count),
+ NGETTEXT("+--%3d line folded",
+ "+--%3d lines folded ", count),
count);
text = buf;
}
@@ -3304,8 +3304,8 @@ void f_foldtext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
}
}
- long count = foldend - foldstart + 1;
- char *txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count);
+ int count = foldend - foldstart + 1;
+ char *txt = NGETTEXT("+-%s%3d line: ", "+-%s%3d lines: ", count);
size_t len = strlen(txt)
+ strlen(dashes) // for %s
+ 20 // for %3ld