refactor: replace TRUE/FALSE macros with C99 true/false

This commit is contained in:
Dundar Göc 2021-07-23 15:25:35 +02:00
parent 192adfe99f
commit 11dcf15682
13 changed files with 31 additions and 38 deletions

View File

@ -540,12 +540,10 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
del_buf = true;
}
/*
* Free all things allocated for this buffer.
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
*/
/* Remember if we are closing the current buffer. Restore the number of
* windows, so that autocommands in buf_freeall() don't get confused. */
// Free all things allocated for this buffer.
// Also calls the "BufDelete" autocommands when del_buf is true.
// Remember if we are closing the current buffer. Restore the number of
// windows, so that autocommands in buf_freeall() don't get confused.
bool is_curbuf = (buf == curbuf);
// When closing the current buffer stop Visual mode before freeing
@ -5046,8 +5044,8 @@ do_arg_all(
xfree(opened);
}
// Return TRUE if "buf" is a prompt buffer.
int bt_prompt(buf_T *buf)
/// @return true if "buf" is a prompt buffer.
bool bt_prompt(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'p';
}

View File

@ -779,7 +779,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
int movelen = oldlen - col - count + 1; // includes trailing NUL
if (movelen <= 1) {
// If we just took off the last character of a non-blank line, and
// fixpos is TRUE, we don't want to end up positioned at the NUL,
// fixpos is true, we don't want to end up positioned at the NUL,
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
if (col > 0 && fixpos && restart_edit == 0
&& (ve_flags & VE_ONEMORE) == 0

View File

@ -1502,10 +1502,10 @@ char_u *get_digraph_for_char(int val_arg)
/// Get a digraph. Used after typing CTRL-K on the command line or in normal
/// mode.
///
/// @param cmdline TRUE when called from the cmdline
/// @param cmdline true when called from the cmdline
///
/// @returns composed character, or NUL when ESC was used.
int get_digraph(int cmdline)
int get_digraph(bool cmdline)
{
int cc;
no_mapping++;

View File

@ -46,7 +46,7 @@ void highlight_init(void)
.id1 = 0, .id2 = 0 }));
}
/// @return TRUE if hl table was reset
/// @return true if hl table was reset
bool highlight_use_hlstate(void)
{
if (hlstate_active) {

View File

@ -62,10 +62,10 @@ int get_indent_buf(buf_T *buf, linenr_T lnum)
}
// Count the size (in window cells) of the indent in line "ptr", with
// 'tabstop' at "ts".
// If @param list is TRUE, count only screen size for tabs.
int get_indent_str(const char_u *ptr, int ts, int list)
/// Count the size (in window cells) of the indent in line "ptr", with
/// 'tabstop' at "ts".
/// If @param list is true, count only screen size for tabs.
int get_indent_str(const char_u *ptr, int ts, bool list)
FUNC_ATTR_NONNULL_ALL
{
int count = 0;
@ -91,9 +91,9 @@ int get_indent_str(const char_u *ptr, int ts, int list)
return count;
}
// Count the size (in window cells) of the indent in line "ptr", using
// variable tabstops.
// if "list" is true, count only screen size for tabs.
/// Count the size (in window cells) of the indent in line "ptr", using
/// variable tabstops.
/// if "list" is true, count only screen size for tabs.
int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
{
int count = 0;

View File

@ -543,7 +543,7 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len,
/// Put the character sequence for "key" with "modifiers" into "dst" and return
/// the resulting length.
/// When "keycode" is TRUE prefer key code, e.g. K_DEL instead of DEL.
/// When "keycode" is true prefer key code, e.g. K_DEL instead of DEL.
/// The sequence is not NUL terminated.
/// This is how characters in a string are encoded.
unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst)

View File

@ -2354,10 +2354,8 @@ int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
return convert_setup_ext(vcp, from, true, to, true);
}
/*
* As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
* "from" unicode charsets be considered utf-8. Same for "to".
*/
/// As convert_setup(), but only when from_unicode_is_utf8 is true will all
/// "from" unicode charsets be considered utf-8. Same for "to".
int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8,
char_u *to, bool to_unicode_is_utf8)
{

View File

@ -101,7 +101,7 @@ typedef struct memfile {
blocknr_T mf_neg_count; /// number of negative blocks numbers
blocknr_T mf_infile_count; /// number of pages in the file
unsigned mf_page_size; /// number of bytes in a page
bool mf_dirty; /// TRUE if there are dirty blocks
bool mf_dirty; /// true if there are dirty blocks
} memfile_T;
#endif // NVIM_MEMFILE_DEFS_H

View File

@ -750,8 +750,8 @@ get_number (
stuffcharReadbuff(':');
if (!exmode_active)
cmdline_row = msg_row;
skip_redraw = TRUE; /* skip redraw once */
do_redraw = FALSE;
skip_redraw = true; // skip redraw once
do_redraw = false;
break;
} else if (c == Ctrl_C || c == ESC || c == 'q') {
n = 0;

View File

@ -570,9 +570,8 @@ static linenr_T find_longest_lnum(void)
return ret;
}
///
/// Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise.
///
/// Do a horizontal scroll.
/// @return true if the cursor moved, false otherwise.
bool mouse_scroll_horiz(int dir)
{
if (curwin->w_p_wrap) {

View File

@ -1340,7 +1340,7 @@ static int normal_check(VimState *state)
quit_more = false;
// If skip redraw is set (for ":" in wait_return()), don't redraw now.
// If there is nothing in the stuff_buffer or do_redraw is TRUE,
// If there is nothing in the stuff_buffer or do_redraw is true,
// update cursor and redraw.
if (skip_redraw || exmode_active) {
skip_redraw = false;
@ -8147,10 +8147,8 @@ static void nv_event(cmdarg_T *cap)
}
}
/*
* Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos".
*/
static int mouse_model_popup(void)
/// @return true when 'mousemodel' is set to "popup" or "popup_setpos".
static bool mouse_model_popup(void)
{
return p_mousem[0] == 'p';
}

View File

@ -88,7 +88,7 @@ typedef struct searchstat
{
int cur; // current position of found words
int cnt; // total count of found words
int exact_match; // TRUE if matched exactly on specified position
bool exact_match; // true if matched exactly on specified position
int incomplete; // 0: search was fully completed
// 1: recomputing was timed out
// 2: max count exceeded

View File

@ -115,10 +115,10 @@ static void sign_group_unref(char_u *groupname)
}
}
/// Returns TRUE if 'sign' is in 'group'.
/// @return true if 'sign' is in 'group'.
/// A sign can either be in the global group (sign->group == NULL)
/// or in a named group. If 'group' is '*', then the sign is part of the group.
int sign_in_group(sign_entry_T *sign, const char_u *group)
bool sign_in_group(sign_entry_T *sign, const char_u *group)
{
return ((group != NULL && STRCMP(group, "*") == 0)
|| (group == NULL && sign->se_group == NULL)