diff options
author | Dundar Göc <gocdundar@gmail.com> | 2021-07-23 15:25:35 +0200 |
---|---|---|
committer | Dundar Göc <gocdundar@gmail.com> | 2021-07-25 21:51:50 +0200 |
commit | 11dcf1568251f7e54f5ea28310e1d603de089eca (patch) | |
tree | defdc5456099598f76fca4e7988d0e33a495928f | |
parent | 192adfe99f33778a85e11fbfdceb37f347a3d235 (diff) | |
download | rneovim-11dcf1568251f7e54f5ea28310e1d603de089eca.tar.gz rneovim-11dcf1568251f7e54f5ea28310e1d603de089eca.tar.bz2 rneovim-11dcf1568251f7e54f5ea28310e1d603de089eca.zip |
refactor: replace TRUE/FALSE macros with C99 true/false
-rw-r--r-- | src/nvim/buffer.c | 14 | ||||
-rw-r--r-- | src/nvim/change.c | 2 | ||||
-rw-r--r-- | src/nvim/digraph.c | 4 | ||||
-rw-r--r-- | src/nvim/highlight.c | 2 | ||||
-rw-r--r-- | src/nvim/indent.c | 14 | ||||
-rw-r--r-- | src/nvim/keymap.c | 2 | ||||
-rw-r--r-- | src/nvim/mbyte.c | 6 | ||||
-rw-r--r-- | src/nvim/memfile_defs.h | 2 | ||||
-rw-r--r-- | src/nvim/misc1.c | 4 | ||||
-rw-r--r-- | src/nvim/mouse.c | 5 | ||||
-rw-r--r-- | src/nvim/normal.c | 8 | ||||
-rw-r--r-- | src/nvim/search.h | 2 | ||||
-rw-r--r-- | src/nvim/sign.c | 4 |
13 files changed, 31 insertions, 38 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 3b4fc6c3df..587ef74b35 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -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'; } diff --git a/src/nvim/change.c b/src/nvim/change.c index ca1ca756bb..b30490deca 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -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 diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index dd32cef1e3..07e484c178 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -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++; diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index 79e474fa2e..29ee7aae56 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -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) { diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 8fa61515ef..c1f9c1e172 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -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; diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 6dacace0a4..277b9ade89 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -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) diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 73e3ba53a5..9cd57affb9 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -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) { diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index 2402d2147d..3eaa7d83e0 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -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 diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 38d0a7dadf..19239036fd 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -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; diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 4c0339e5f4..f1ad0ed105 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -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) { diff --git a/src/nvim/normal.c b/src/nvim/normal.c index cba7b7a10b..4213e6f946 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -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'; } diff --git a/src/nvim/search.h b/src/nvim/search.h index 98ddaa5eeb..0dbaf79c37 100644 --- a/src/nvim/search.h +++ b/src/nvim/search.h @@ -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 diff --git a/src/nvim/sign.c b/src/nvim/sign.c index d884ae62f4..c6f59b42b8 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -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) |