aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2021-09-18 00:24:39 +0200
committerGitHub <noreply@github.com>2021-09-18 00:24:39 +0200
commit1f49268c46fcbe65f7e2e2cb620e6f51c059cf9e (patch)
treee7cea7cc17ce0e5004ef040f5d0ffa1384c06ea9 /src
parentede5695eb194e9b607421415525177888b447753 (diff)
downloadrneovim-1f49268c46fcbe65f7e2e2cb620e6f51c059cf9e.tar.gz
rneovim-1f49268c46fcbe65f7e2e2cb620e6f51c059cf9e.tar.bz2
rneovim-1f49268c46fcbe65f7e2e2cb620e6f51c059cf9e.zip
refactor: convert TRUE/FALSE to true/false (#15660)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c16
-rw-r--r--src/nvim/ex_docmd.c6
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/fold.c39
-rw-r--r--src/nvim/getchar.c6
-rw-r--r--src/nvim/ops.c20
-rw-r--r--src/nvim/path.c10
-rw-r--r--src/nvim/screen.c6
8 files changed, 49 insertions, 56 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 5607de3cc1..2736e9a14f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -846,13 +846,13 @@ int skip_expr(char_u **pp)
return eval1(pp, &rettv, FALSE);
}
-/*
- * Top level evaluation function, returning a string.
- * When "convert" is TRUE convert a List into a sequence of lines and convert
- * a Float to a String.
- * Return pointer to allocated memory, or NULL for failure.
- */
-char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert)
+/// Top level evaluation function, returning a string.
+///
+/// @param convert when true convert a List into a sequence of lines and convert
+/// a Float to a String.
+///
+/// @return pointer to allocated memory, or NULL for failure.
+char_u *eval_to_string(char_u *arg, char_u **nextcmd, bool convert)
{
typval_T tv;
char *retval;
@@ -8520,7 +8520,7 @@ static char_u *make_expanded_name(const char_u *in_start, char_u *expr_start,
c1 = *in_end;
*in_end = NUL;
- temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE);
+ temp_result = eval_to_string(expr_start + 1, &nextcmd, false);
if (temp_result != NULL && nextcmd == NULL) {
retval = xmalloc(STRLEN(temp_result) + (expr_start - in_start)
+ (in_end - expr_end) + 1);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index c52db35902..34497eb212 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6431,9 +6431,9 @@ static void ex_colorscheme(exarg_T *eap)
char_u *expr = vim_strsave((char_u *)"g:colors_name");
char_u *p = NULL;
- ++emsg_off;
- p = eval_to_string(expr, NULL, FALSE);
- --emsg_off;
+ emsg_off++;
+ p = eval_to_string(expr, NULL, false);
+ emsg_off--;
xfree(expr);
if (p != NULL) {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 870c6ca2b1..b7dbda3d99 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -5546,7 +5546,7 @@ char_u * file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *all
char_u *reg_pat;
const char_u *p;
int nested = 0;
- int add_dollar = TRUE;
+ bool add_dollar = true;
if (allow_dirs != NULL) {
*allow_dirs = FALSE;
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index bfc72e6af8..7a017702ee 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -143,12 +143,10 @@ int hasAnyFolding(win_T *win)
}
// hasFolding() {{{2
-/*
- * Return TRUE if line "lnum" in the current window is part of a closed
- * fold.
- * When returning TRUE, *firstp and *lastp are set to the first and last
- * lnum of the sequence of folded lines (skipped when NULL).
- */
+/// When returning true, *firstp and *lastp are set to the first and last
+/// lnum of the sequence of folded lines (skipped when NULL).
+///
+/// @return true if line "lnum" in the current window is part of a closed fold.
bool hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp)
{
return hasFoldingWin(curwin, lnum, firstp, lastp, true, NULL);
@@ -545,11 +543,9 @@ static int checkCloseRec(garray_T *gap, linenr_T lnum, int level)
}
// foldCreateAllowed() {{{2
-/*
- * Return TRUE if it's allowed to manually create or delete a fold.
- * Give an error message and return FALSE if not.
- */
-int foldManualAllowed(int create)
+/// Return TRUE if it's allowed to manually create or delete a fold.
+/// Give an error message and return FALSE if not.
+int foldManualAllowed(bool create)
{
if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) {
return TRUE;
@@ -1106,12 +1102,11 @@ void cloneFoldGrowArray(garray_T *from, garray_T *to)
}
// foldFind() {{{2
-/*
- * Search for line "lnum" in folds of growarray "gap".
- * Set *fpp to the fold struct for the fold that contains "lnum" or
- * the first fold below it (careful: it can be beyond the end of the array!).
- * Returns FALSE when there is no fold that contains "lnum".
- */
+/// Search for line "lnum" in folds of growarray "gap".
+/// Set *fpp to the fold struct for the fold that contains "lnum" or
+/// the first fold below it (careful: it can be beyond the end of the array!).
+///
+/// @return false when there is no fold that contains "lnum".
static bool foldFind(const garray_T *gap, linenr_T lnum, fold_T **fpp)
{
linenr_T low, high;
@@ -1141,7 +1136,7 @@ static bool foldFind(const garray_T *gap, linenr_T lnum, fold_T **fpp)
} else {
// lnum is inside this fold
*fpp = fp + i;
- return TRUE;
+ return true;
}
}
*fpp = fp + low;
@@ -1906,8 +1901,8 @@ void foldtext_cleanup(char_u *str)
{
char_u *s;
char_u *p;
- int did1 = FALSE;
- int did2 = FALSE;
+ bool did1 = false;
+ bool did2 = false;
// Ignore leading and trailing white space in 'commentstring'.
char_u *cms_start = skipwhite(curbuf->b_p_cms);
@@ -1960,11 +1955,11 @@ void foldtext_cleanup(char_u *str)
} else if (cms_end != NULL) {
if (!did1 && cms_slen > 0 && STRNCMP(s, cms_start, cms_slen) == 0) {
len = cms_slen;
- did1 = TRUE;
+ did1 = true;
} else if (!did2 && cms_elen > 0
&& STRNCMP(s, cms_end, cms_elen) == 0) {
len = cms_elen;
- did2 = TRUE;
+ did2 = true;
}
}
if (len != 0) {
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 11e3b9bc2d..3bf9d92696 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -3916,9 +3916,9 @@ eval_map_expr (
save_cursor = curwin->w_cursor;
save_msg_col = msg_col;
save_msg_row = msg_row;
- p = eval_to_string(expr, NULL, FALSE);
- --textlock;
- --ex_normal_lock;
+ p = eval_to_string(expr, NULL, false);
+ textlock--;
+ ex_normal_lock--;
curwin->w_cursor = save_cursor;
msg_col = save_msg_col;
msg_row = save_msg_row;
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index e344bb5e77..12fb8439f1 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -765,9 +765,9 @@ char_u *get_expr_line(void)
return expr_copy;
}
- ++nested;
- rv = eval_to_string(expr_copy, NULL, TRUE);
- --nested;
+ nested++;
+ rv = eval_to_string(expr_copy, NULL, true);
+ nested--;
xfree(expr_copy);
return rv;
}
@@ -1237,16 +1237,14 @@ int insert_reg(int regname, bool literally_arg)
return retval;
}
-/*
- * Stuff a string into the typeahead buffer, such that edit() will insert it
- * literally ("literally" TRUE) or interpret is as typed characters.
- */
-static void stuffescaped(const char *arg, int literally)
+/// Stuff a string into the typeahead buffer, such that edit() will insert it
+/// literally ("literally" true) or interpret is as typed characters.
+static void stuffescaped(const char *arg, bool literally)
{
while (*arg != NUL) {
// Stuff a sequence of normal ASCII characters, that's fast. Also
// stuff K_SPECIAL to get the effect of a special key when "literally"
- // is TRUE.
+ // is true.
const char *const start = arg;
while ((*arg >= ' ' && *arg < DEL) || ((uint8_t)(*arg) == K_SPECIAL
&& !literally)) {
@@ -2890,7 +2888,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
int indent;
int orig_indent = 0; // init for gcc
int indent_diff = 0; // init for gcc
- int first_indent = TRUE;
+ bool first_indent = true;
int lendiff = 0;
pos_T old_pos;
char_u *insert_string = NULL;
@@ -3487,7 +3485,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
} else if (first_indent) {
indent_diff = orig_indent - get_indent();
indent = orig_indent;
- first_indent = FALSE;
+ first_indent = false;
} else if ((indent = get_indent() + indent_diff) < 0) {
indent = 0;
}
diff --git a/src/nvim/path.c b/src/nvim/path.c
index e8d5cd9102..5d14eba0a5 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1349,11 +1349,11 @@ static int expand_backtick(
// Create the command: lop off the backticks.
char_u *cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
- if (*cmd == '=') /* `={expr}`: Expand expression */
- buffer = eval_to_string(cmd + 1, &p, TRUE);
- else
- buffer = get_cmd_output(cmd, NULL,
- (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
+ if (*cmd == '=') { // `={expr}`: Expand expression
+ buffer = eval_to_string(cmd + 1, &p, true);
+ } else {
+ buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
+ }
xfree(cmd);
if (buffer == NULL) {
return -1;
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 3257eac9a9..e1846d4569 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5335,9 +5335,9 @@ bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len)
curbuf = wp->w_buffer;
curwin = wp;
STRCPY(buf, "b:keymap_name"); // must be writable
- ++emsg_skip;
- s = p = eval_to_string(buf, NULL, FALSE);
- --emsg_skip;
+ emsg_skip++;
+ s = p = eval_to_string(buf, NULL, false);
+ emsg_skip--;
curbuf = old_curbuf;
curwin = old_curwin;
if (p == NULL || *p == NUL) {