mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 14:28:18 +00:00
refactor: convert TRUE/FALSE to true/false (#15660)
This commit is contained in:
@@ -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);
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user