aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-16 22:14:28 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-19 11:43:21 +0100
commit7f6b775b45de5011ff1c44e63e57551566d80704 (patch)
tree54eab8482051d2d1a958fcf9f6c9bcbb02827717 /src
parent693aea0e9e1032aee85d56c1a3f33e0811dbdc18 (diff)
downloadrneovim-7f6b775b45de5011ff1c44e63e57551566d80704.tar.gz
rneovim-7f6b775b45de5011ff1c44e63e57551566d80704.tar.bz2
rneovim-7f6b775b45de5011ff1c44e63e57551566d80704.zip
refactor: use `bool` to represent boolean values
Diffstat (limited to 'src')
-rw-r--r--src/nvim/arabic.c18
-rw-r--r--src/nvim/arglist.c4
-rw-r--r--src/nvim/autocmd.c6
-rw-r--r--src/nvim/buffer.c4
-rw-r--r--src/nvim/bufwrite.c16
-rw-r--r--src/nvim/change.c8
-rw-r--r--src/nvim/cmdexpand.c8
-rw-r--r--src/nvim/cmdhist.c2
-rw-r--r--src/nvim/cursor_shape.c2
-rw-r--r--src/nvim/diff.c16
-rw-r--r--src/nvim/drawline.c2
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/eval/funcs.c4
-rw-r--r--src/nvim/eval/userfunc.c8
-rw-r--r--src/nvim/eval/vars.c2
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/ex_eval.c12
-rw-r--r--src/nvim/ex_getln.c11
-rw-r--r--src/nvim/ex_session.c12
-rw-r--r--src/nvim/file_search.c22
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/fold.c16
-rw-r--r--src/nvim/getchar.c12
-rw-r--r--src/nvim/grid.c2
-rw-r--r--src/nvim/highlight_group.c2
-rw-r--r--src/nvim/indent.c8
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/mapping.c4
-rw-r--r--src/nvim/memline.c4
-rw-r--r--src/nvim/menu.c10
-rw-r--r--src/nvim/message.c13
-rw-r--r--src/nvim/move.c2
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c13
-rw-r--r--src/nvim/option.c8
-rw-r--r--src/nvim/os/users.c2
-rw-r--r--src/nvim/path.c27
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--src/nvim/quickfix.c4
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/sign.c2
-rw-r--r--src/nvim/statusline.c8
-rw-r--r--src/nvim/strings.c2
-rw-r--r--src/nvim/syntax.c13
-rw-r--r--src/nvim/tag.c20
-rw-r--r--src/nvim/textformat.c2
-rw-r--r--src/nvim/textobject.c4
47 files changed, 171 insertions, 182 deletions
diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c
index f575bf30b8..665e61c277 100644
--- a/src/nvim/arabic.c
+++ b/src/nvim/arabic.c
@@ -270,22 +270,22 @@ bool arabic_combine(int one, int two)
return false;
}
-/// A_is_iso returns true if 'c' is an Arabic ISO-8859-6 character
+/// @return true if 'c' is an Arabic ISO-8859-6 character
/// (alphabet/number/punctuation)
-static int A_is_iso(int c)
+static bool A_is_iso(int c)
{
return find_achar(c) != NULL;
}
-/// A_is_ok returns true if 'c' is an Arabic 10646 (8859-6 or Form-B)
-static int A_is_ok(int c)
+/// @return true if 'c' is an Arabic 10646 (8859-6 or Form-B)
+static bool A_is_ok(int c)
{
return (A_is_iso(c) || c == a_BYTE_ORDER_MARK);
}
-/// A_is_valid returns true if 'c' is an Arabic 10646 (8859-6 or Form-B)
-/// with some exceptions/exclusions
-static int A_is_valid(int c)
+/// @return true if 'c' is an Arabic 10646 (8859-6 or Form-B)
+/// with some exceptions/exclusions
+static bool A_is_valid(int c)
{
return (A_is_ok(c) && c != a_HAMZA);
}
@@ -304,8 +304,8 @@ int arabic_shape(int c, int *c1p, int prev_c, int prev_c1, int next_c)
}
int curr_c;
- int curr_laa = arabic_combine(c, *c1p);
- int prev_laa = arabic_combine(prev_c, prev_c1);
+ bool curr_laa = arabic_combine(c, *c1p);
+ bool prev_laa = arabic_combine(prev_c, prev_c1);
if (curr_laa) {
if (A_is_valid(prev_c) && can_join(prev_c, a_LAM) && !prev_laa) {
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 8bc8edb572..a2f3aa11ca 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -280,7 +280,7 @@ static char *do_one_arg(char *str)
/// Separate the arguments in "str" and return a list of pointers in the
/// growarray "gap".
-static void get_arglist(garray_T *gap, char *str, int escaped)
+static void get_arglist(garray_T *gap, char *str, bool escaped)
{
ga_init(gap, (int)sizeof(char *), 20);
while (*str != NUL) {
@@ -426,7 +426,7 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
garray_T new_ga;
int exp_count;
char **exp_files;
- int arg_escaped = true;
+ bool arg_escaped = true;
if (check_arglist_locked() == FAIL) {
return FAIL;
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index bfcf566fe3..9605e3b4db 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -913,7 +913,7 @@ int do_autocmd_event(event_T event, const char *pat, bool once, int nested, char
int patlen = (int)aucmd_pattern_length(pat);
while (patlen) {
// detect special <buffer[=X]> buffer-local patterns
- int is_buflocal = aupat_is_buflocal(pat, patlen);
+ bool is_buflocal = aupat_is_buflocal(pat, patlen);
if (is_buflocal) {
const int buflocal_nr = aupat_get_buflocal_nr(pat, patlen);
@@ -977,7 +977,7 @@ int autocmd_register(int64_t id, event_T event, const char *pat, int patlen, int
const int findgroup = group == AUGROUP_ALL ? current_augroup : group;
// detect special <buffer[=X]> buffer-local patterns
- const int is_buflocal = aupat_is_buflocal(pat, patlen);
+ const bool is_buflocal = aupat_is_buflocal(pat, patlen);
int buflocal_nr = 0;
char buflocal_pat[BUFLOCAL_PAT_LEN]; // for "<buffer=X>"
@@ -1568,7 +1568,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
static int nesting = 0;
char *save_cmdarg;
varnumber_T save_cmdbang;
- static int filechangeshell_busy = false;
+ static bool filechangeshell_busy = false;
proftime_T wait_time;
bool did_save_redobuff = false;
save_redo_T save_redo;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 75c6545c1d..7660093fc2 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -201,13 +201,13 @@ bool buf_ensure_loaded(buf_T *buf)
/// @param flags_arg extra flags for readfile()
///
/// @return FAIL for failure, OK otherwise.
-int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
+int open_buffer(bool read_stdin, exarg_T *eap, int flags_arg)
{
int flags = flags_arg;
int retval = OK;
bufref_T old_curbuf;
OptInt old_tw = curbuf->b_p_tw;
- int read_fifo = false;
+ bool read_fifo = false;
bool silent = shortmess(SHM_FILEINFO);
// The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c
index f8df273375..67e5fb3b6f 100644
--- a/src/nvim/bufwrite.c
+++ b/src/nvim/bufwrite.c
@@ -799,7 +799,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
char *backup_ext = *p_bex == NUL ? ".bak" : p_bex;
if (*backup_copyp) {
- int some_error = false;
+ bool some_error = false;
// Try to make the backup in each directory in the 'bdir' option.
//
@@ -1059,14 +1059,14 @@ nobackup:
///
/// @return FAIL for failure, OK otherwise
int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T end, exarg_T *eap,
- int append, int forceit, int reset_changed, int filtering)
+ bool append, bool forceit, bool reset_changed, bool filtering)
{
int retval = OK;
int msg_save = msg_scroll;
- int prev_got_int = got_int;
+ bool prev_got_int = got_int;
// writing everything
- int whole = (start == 1 && end == buf->b_ml.ml_line_count);
- int write_undo_file = false;
+ bool whole = (start == 1 && end == buf->b_ml.ml_line_count);
+ bool write_undo_file = false;
context_sha256_T sha_ctx;
unsigned bkc = get_bkc_value(buf);
@@ -1245,7 +1245,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
}
#if defined(UNIX)
- int made_writable = false; // 'w' bit has been set
+ bool made_writable = false; // 'w' bit has been set
// When using ":w!" and the file was read-only: make it writable
if (forceit && perm >= 0 && !(perm & 0200)
@@ -1352,7 +1352,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
}
}
- int notconverted = false;
+ bool notconverted = false;
if (converted && wb_flags == 0
&& write_info.bw_iconv_fd == (iconv_t)-1
@@ -1364,7 +1364,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
notconverted = true;
}
- int no_eol = false; // no end-of-line written
+ bool no_eol = false; // no end-of-line written
int nchars;
linenr_T lnum;
int fileformat;
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 622eb3b9a5..99698f2e5d 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1322,7 +1322,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
char *comment_end = NULL; // where lead_end has been found
int extra_space = false; // append extra space
int current_flag;
- int require_blank = false; // requires blank after middle
+ bool require_blank = false; // requires blank after middle
char *p2;
// If the comment leader has the start, middle or end flag, it may not
@@ -1979,7 +1979,7 @@ void del_lines(linenr_T nlines, bool undo)
int get_leader_len(char *line, char **flags, bool backward, bool include_space)
{
int j;
- int got_com = false;
+ bool got_com = false;
char part_buf[COM_MAX_LEN]; // buffer for one option part
char *string; // pointer to comment string
int middle_match_len = 0;
@@ -1994,7 +1994,7 @@ int get_leader_len(char *line, char **flags, bool backward, bool include_space)
// Repeat to match several nested comment strings.
while (line[i] != NUL) {
// scan through the 'comments' option for a match
- int found_one = false;
+ bool found_one = false;
for (char *list = curbuf->b_p_com; *list;) {
// Get one option part into part_buf[]. Advance "list" to next
// one. Put "string" at start of string.
@@ -2129,7 +2129,7 @@ int get_last_leader_offset(char *line, char **flags)
int i = (int)strlen(line);
while (--i >= lower_check_bound) {
// scan through the 'comments' option for a match
- int found_one = false;
+ bool found_one = false;
for (char *list = curbuf->b_p_com; *list;) {
char *flags_save = list;
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 523145af1b..31b385c466 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -841,7 +841,7 @@ static char *find_longest_match(expand_T *xp, int options)
char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode)
{
char *ss = NULL;
- int orig_saved = false;
+ bool orig_saved = false;
// first handle the case of using an old match
if (mode == WILD_NEXT || mode == WILD_PREV
@@ -3311,7 +3311,7 @@ static int wildmenu_process_key_menunames(CmdlineInfo *cclp, int key, expand_T *
} else if (key == K_UP) {
// Hitting <Up>: Remove one submenu name in front of the
// cursor
- int found = false;
+ bool found = false;
int j = (int)(xp->xp_pattern - cclp->cmdbuff);
int i = 0;
@@ -3367,7 +3367,7 @@ static int wildmenu_process_key_filenames(CmdlineInfo *cclp, int key, expand_T *
KeyTyped = true; // in case the key was mapped
} else if (strncmp(xp->xp_pattern, upseg + 1, 3) == 0 && key == K_DOWN) {
// If in a direct ancestor, strip off one ../ to go down
- int found = false;
+ bool found = false;
int j = cclp->cmdpos;
int i = (int)(xp->xp_pattern - cclp->cmdbuff);
@@ -3388,7 +3388,7 @@ static int wildmenu_process_key_filenames(CmdlineInfo *cclp, int key, expand_T *
}
} else if (key == K_UP) {
// go up a directory
- int found = false;
+ bool found = false;
int j = cclp->cmdpos - 1;
int i = (int)(xp->xp_pattern - cclp->cmdbuff);
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c
index 9396fdac7f..51a73dec10 100644
--- a/src/nvim/cmdhist.c
+++ b/src/nvim/cmdhist.c
@@ -374,7 +374,7 @@ static int calc_hist_idx(int histype, int num)
histentry_T *hist = history[histype];
if (num > 0) {
- int wrapped = false;
+ bool wrapped = false;
while (hist[i].hisnum > num) {
if (--i < 0) {
if (wrapped) {
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index fe07c33df5..64cf1ea263 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -110,7 +110,7 @@ const char *parse_shape_opt(int what)
int all_idx;
int len;
int i;
- int found_ve = false; // found "ve" flag
+ bool found_ve = false; // found "ve" flag
// First round: check for errors; second round: do it for real.
for (int round = 1; round <= 2; round++) {
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 483182dc25..765cbdadd2 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -59,7 +59,7 @@
#include "nvim/window.h"
#include "xdiff/xdiff.h"
-static int diff_busy = false; // using diff structs, don't change them
+static bool diff_busy = false; // using diff structs, don't change them
static bool diff_need_update = false; // ex_diffupdate needs to be called
// Flags obtained from the 'diffopt' option
@@ -384,7 +384,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
}
dp->df_lnum[idx] += amount_after;
} else {
- int check_unchanged = false;
+ bool check_unchanged = false;
// 2. 3. 4. 5.: inserted/deleted lines touching this diff.
if (deleted > 0) {
@@ -1003,7 +1003,7 @@ theend:
static int check_external_diff(diffio_T *diffio)
{
// May try twice, first with "-a" and then without.
- int io_error = false;
+ bool io_error = false;
TriState ok = kFalse;
while (true) {
ok = kFalse;
@@ -1472,7 +1472,7 @@ void diff_win_options(win_T *wp, int addbuf)
/// @param eap
void ex_diffoff(exarg_T *eap)
{
- int diffwin = false;
+ bool diffwin = false;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (eap->forceit ? wp->w_p_diff : (wp == curwin)) {
@@ -2155,12 +2155,12 @@ int diff_check_with_linestatus(win_T *wp, linenr_T lnum, int *linestatus)
}
if (lnum < dp->df_lnum[idx] + dp->df_count[idx]) {
- int zero = false;
+ bool zero = false;
// Changed or inserted line. If the other buffers have a count of
// zero, the lines were inserted. If the other buffers have the same
// count, check if the lines are identical.
- int cmp = false;
+ bool cmp = false;
for (int i = 0; i < DB_COUNT; i++) {
if ((i != idx) && (curtab->tp_diffbuf[i] != NULL)) {
@@ -2195,7 +2195,7 @@ int diff_check_with_linestatus(win_T *wp, linenr_T lnum, int *linestatus)
// the difference. Can't remove the entry here, we might be halfway
// through updating the window. Just report the text as unchanged.
// Other windows might still show the change though.
- if (zero == false) {
+ if (!zero) {
return 0;
}
return -2;
@@ -2845,7 +2845,7 @@ void ex_diffgetput(exarg_T *eap)
}
if (*eap->arg == NUL) {
- int found_not_ma = false;
+ bool found_not_ma = false;
// No argument: Find the other buffer in the list of diff buffers.
for (idx_other = 0; idx_other < DB_COUNT; idx_other++) {
if ((curtab->tp_diffbuf[idx_other] != curbuf)
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 77bd05eb55..ee1cd0a3ce 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -1076,7 +1076,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
int prev_syntax_id = 0;
int conceal_attr = win_hl_attr(wp, HLF_CONCEAL);
bool is_concealing = false;
- int did_wcol = false;
+ bool did_wcol = false;
int old_boguscols = 0;
#define VCOL_HLC (wlv.vcol - wlv.vcol_off)
#define FIX_FOR_BOGUSCOLS \
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 7d869881e8..21bb325e37 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -564,7 +564,7 @@ static char *redir_varname = NULL;
/// @param append append to an existing variable
///
/// @return OK if successfully completed the setup. FAIL otherwise.
-int var_redir_start(char *name, int append)
+int var_redir_start(char *name, bool append)
{
// Catch a bad name early.
if (!eval_isnamec1(*name)) {
@@ -765,7 +765,7 @@ void fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, bool skip)
/// @param skip only parse, don't execute
///
/// @return true or false.
-int eval_to_bool(char *arg, bool *error, exarg_T *eap, int skip)
+bool eval_to_bool(char *arg, bool *error, exarg_T *eap, int skip)
{
typval_T tv;
bool retval = false;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 81ae208560..f13235c3e9 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -305,7 +305,7 @@ int call_internal_method(const char *const fname, const int argcount, typval_T *
}
/// @return true for a non-zero Number and a non-empty String.
-static int non_zero_arg(typval_T *argvars)
+static bool non_zero_arg(typval_T *argvars)
{
return ((argvars[0].v_type == VAR_NUMBER
&& argvars[0].vval.v_number != 0)
@@ -2443,7 +2443,7 @@ static void getpos_both(typval_T *argvars, typval_T *rettv, bool getcurpos, bool
: (varnumber_T)0));
tv_list_append_number(l, (fp != NULL) ? (varnumber_T)fp->coladd : (varnumber_T)0);
if (getcurpos) {
- const int save_set_curswant = curwin->w_set_curswant;
+ const bool save_set_curswant = curwin->w_set_curswant;
const colnr_T save_curswant = curwin->w_curswant;
const colnr_T save_virtcol = curwin->w_virtcol;
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index cce02e6daf..5e943711d1 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -928,7 +928,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
int tv_to_free_len = 0;
proftime_T wait_start;
proftime_T call_start;
- int started_profiling = false;
+ bool started_profiling = false;
bool did_save_redo = false;
save_redo_T save_redo;
@@ -3035,7 +3035,7 @@ static inline bool fc_referenced(const funccall_T *const fc)
/// @return true if items in "fc" do not have "copyID". That means they are not
/// referenced from anywhere that is in use.
-static int can_free_funccal(funccall_T *fc, int copyID)
+static bool can_free_funccal(funccall_T *fc, int copyID)
{
return fc->fc_l_varlist.lv_copyID != copyID
&& fc->fc_l_vars.dv_copyID != copyID
@@ -3048,7 +3048,7 @@ void ex_return(exarg_T *eap)
{
char *arg = eap->arg;
typval_T rettv;
- int returning = false;
+ bool returning = false;
if (current_funccal == NULL) {
emsg(_("E133: :return not inside a function"));
@@ -3395,7 +3395,7 @@ end:
///
/// @return true when the return can be carried out,
/// false when the return gets pending.
-int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv)
+bool do_return(exarg_T *eap, bool reanimate, bool is_cmd, void *rettv)
{
cstack_T *const cstack = eap->cstack;
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 9897ca77f1..de2fddb083 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -616,7 +616,7 @@ static void list_tab_vars(int *first)
/// List variables in "arg".
static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
{
- int error = false;
+ bool error = false;
int len;
const char *name;
const char *name_start;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index d8e2c54efa..c268f47323 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6212,7 +6212,7 @@ static void ex_redir(exarg_T *eap)
semsg(_(e_invarg2), eap->arg);
}
} else if (*arg == '=' && arg[1] == '>') {
- int append;
+ bool append;
// redirect to a variable
close_redir();
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index bc4cb634e8..c239e8a9ea 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -92,7 +92,7 @@ static void discard_pending_return(typval_T *p)
// expression evaluation is done without producing any error messages, but all
// error messages on parsing errors during the expression evaluation are given
// (even if a try conditional is active).
-static int cause_abort = false;
+static bool cause_abort = false;
/// @return true when immediately aborting on error, or when an interrupt
/// occurred or an exception was thrown but not caught.
@@ -844,7 +844,7 @@ void ex_if(exarg_T *eap)
int skip = CHECK_SKIP;
bool error;
- int result = eval_to_bool(eap->arg, &error, eap, skip);
+ bool result = eval_to_bool(eap->arg, &error, eap, skip);
if (!skip && !error) {
if (result) {
@@ -971,7 +971,7 @@ void ex_while(exarg_T *eap)
if (cstack->cs_idx == CSTACK_LEN - 1) {
eap->errmsg = _("E585: :while/:for nesting too deep");
} else {
- int result;
+ bool result;
// The loop flag is set when we have jumped back from the matching
// ":endwhile" or ":endfor". When not set, need to initialise this
// cstack entry.
@@ -1183,7 +1183,7 @@ void ex_throw(exarg_T *eap)
/// used for rethrowing an uncaught exception.
void do_throw(cstack_T *cstack)
{
- int inactivate_try = false;
+ bool inactivate_try = false;
// Cleanup and deactivate up to the next surrounding try conditional that
// is not in its finally clause. Normally, do not deactivate the try
@@ -1861,7 +1861,7 @@ void leave_cleanup(cleanup_T *csp)
int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
{
int idx;
- int stop = false;
+ bool stop = false;
for (idx = cstack->cs_idx; idx >= 0; idx--) {
if (cstack->cs_flags[idx] & CSF_TRY) {
@@ -1998,7 +1998,7 @@ void ex_endfunction(exarg_T *eap)
}
/// @return true if the string "p" looks like a ":while" or ":for" command.
-int has_loop_cmd(char *p)
+bool has_loop_cmd(char *p)
{
// skip modifiers, white space and ':'
while (true) {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index afaf0a6e2b..974115d803 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -109,7 +109,7 @@ typedef struct command_line_state {
int count;
int indent;
int c;
- int gotesc; // true when <ESC> just typed
+ bool gotesc; // true when <ESC> just typed
int do_abbr; // when true check for abbr.
char *lookfor; // string to match
int hiscnt; // current history line in use
@@ -584,7 +584,8 @@ static int may_add_char_to_search(int firstc, int *c, incsearch_state_T *s)
return OK;
}
-static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool call_update_screen)
+static void finish_incsearch_highlighting(bool gotesc, incsearch_state_T *s,
+ bool call_update_screen)
{
if (!s->did_incsearch) {
return;
@@ -840,7 +841,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
// error printed below, to avoid redraw issues
tl_ret = try_leave(&tstate, &err);
if (tv_dict_get_number(dict, "abort") != 0) {
- s->gotesc = 1;
+ s->gotesc = true;
}
restore_v_event(dict, &save_v_event);
}
@@ -4206,7 +4207,7 @@ int get_cmdline_firstc(void)
int get_list_range(char **str, int *num1, int *num2)
{
int len;
- int first = false;
+ bool first = false;
varnumber_T num;
*str = skipwhite((*str));
@@ -4280,7 +4281,7 @@ static int open_cmdwin(void)
int save_restart_edit = restart_edit;
int save_State = State;
bool save_exmode = exmode_active;
- int save_cmdmsg_rl = cmdmsg_rl;
+ bool save_cmdmsg_rl = cmdmsg_rl;
// Can't do this when text or buffer is locked.
// Can't do this recursively. Can't do it when typing a password.
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c
index 45f05e10f2..6ae401a58c 100644
--- a/src/nvim/ex_session.c
+++ b/src/nvim/ex_session.c
@@ -59,7 +59,7 @@ static int put_view_curpos(FILE *fd, const win_T *wp, char *spaces)
return r >= 0;
}
-static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
+static int ses_winsizes(FILE *fd, bool restore_size, win_T *tab_firstwin)
{
if (restore_size && (ssop_flags & SSOP_WINSIZE)) {
int n = 0;
@@ -314,7 +314,7 @@ static int ses_put_fname(FILE *fd, char *name, unsigned *flagp)
static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx)
{
int f;
- int did_next = false;
+ bool did_next = false;
// Always restore cursor position for ":mksession". For ":mkview" only
// when 'viewoptions' contains "cursor".
@@ -528,8 +528,8 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
/// @return FAIL on error, OK otherwise.
static int makeopens(FILE *fd, char *dirnow)
{
- int only_save_windows = true;
- int restore_size = true;
+ bool only_save_windows = true;