refactor: uncrustify

Notable changes: replace all infinite loops to `while(true)` and remove
`int` from `unsigned int`.
This commit is contained in:
dundargoc 2023-04-26 23:23:44 +02:00 committed by GitHub
parent 7d0479c558
commit 3b0df1780e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 324 additions and 324 deletions

View File

@ -1168,7 +1168,7 @@ static bool extmark_get_index_from_obj(buf_T *buf, Integer ns_id, Object obj, in
Integer pos_row = pos.items[0].data.integer; Integer pos_row = pos.items[0].data.integer;
Integer pos_col = pos.items[1].data.integer; Integer pos_col = pos.items[1].data.integer;
*row = (int)(pos_row >= 0 ? pos_row : MAXLNUM); *row = (int)(pos_row >= 0 ? pos_row : MAXLNUM);
*col = (colnr_T)(pos_col >= 0 ? pos_col : MAXCOL); *col = (colnr_T)(pos_col >= 0 ? pos_col : MAXCOL);
return true; return true;
} else { } else {

View File

@ -546,7 +546,7 @@ void set_option_to(uint64_t channel_id, void *to, int type, String name, Object
// For global-win-local options -> setlocal // For global-win-local options -> setlocal
// For win-local options -> setglobal and setlocal (opt_flags == 0) // For win-local options -> setglobal and setlocal (opt_flags == 0)
const int opt_flags = (type == SREQ_WIN && !(flags & SOPT_GLOBAL)) ? 0 : const int opt_flags = (type == SREQ_WIN && !(flags & SOPT_GLOBAL)) ? 0 :
(type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL; (type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL;
WITH_SCRIPT_CONTEXT(channel_id, { WITH_SCRIPT_CONTEXT(channel_id, {
access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err); access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err);

View File

@ -51,7 +51,7 @@ typedef struct {
const size_t len_ = (size_t)(len); \ const size_t len_ = (size_t)(len); \
const char *const str_ = (str); \ const char *const str_ = (str); \
assert(len_ == 0 || str_ != NULL); \ assert(len_ == 0 || str_ != NULL); \
kvi_push(edata->stack, STRING_OBJ(cbuf_to_string((len_?str_:""), len_))); \ kvi_push(edata->stack, STRING_OBJ(cbuf_to_string((len_ ? str_ : ""), len_))); \
} while (0) } while (0)
#define TYPVAL_ENCODE_CONV_STR_STRING TYPVAL_ENCODE_CONV_STRING #define TYPVAL_ENCODE_CONV_STR_STRING TYPVAL_ENCODE_CONV_STRING
@ -275,7 +275,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
case kObjectTypeBoolean: case kObjectTypeBoolean:
tv->v_type = VAR_BOOL; tv->v_type = VAR_BOOL;
tv->vval.v_bool = obj.data.boolean? kBoolVarTrue: kBoolVarFalse; tv->vval.v_bool = obj.data.boolean ? kBoolVarTrue : kBoolVarFalse;
break; break;
case kObjectTypeBuffer: case kObjectTypeBuffer:

View File

@ -852,7 +852,7 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
if (aall->had_tab > 0) { if (aall->had_tab > 0) {
goto_tabpage_tp(first_tabpage, true, true); goto_tabpage_tp(first_tabpage, true, true);
} }
for (;;) { while (true) {
win_T *wpnext = NULL; win_T *wpnext = NULL;
tabpage_T *tpnext = curtab->tp_next; tabpage_T *tpnext = curtab->tp_next;
for (win_T *wp = firstwin; wp != NULL; wp = wpnext) { for (win_T *wp = firstwin; wp != NULL; wp = wpnext) {
@ -1148,7 +1148,7 @@ char *arg_all(void)
// Do this loop two times: // Do this loop two times:
// first time: compute the total length // first time: compute the total length
// second time: concatenate the names // second time: concatenate the names
for (;;) { while (true) {
int len = 0; int len = 0;
for (int idx = 0; idx < ARGCOUNT; idx++) { for (int idx = 0; idx < ARGCOUNT; idx++) {
char *p = alist_name(&ARGLIST[idx]); char *p = alist_name(&ARGLIST[idx]);

View File

@ -2185,7 +2185,7 @@ char *getnextac(int c, void *cookie, int indent, bool do_concat)
} }
// repeat until we find an autocommand to execute // repeat until we find an autocommand to execute
for (;;) { while (true) {
// skip removed commands // skip removed commands
while (acp->nextcmd != NULL while (acp->nextcmd != NULL
&& aucmd_exec_is_deleted(acp->nextcmd->exec)) { && aucmd_exec_is_deleted(acp->nextcmd->exec)) {

View File

@ -1403,7 +1403,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
if (buf == NULL) { // No previous buffer, Try 2'nd approach if (buf == NULL) { // No previous buffer, Try 2'nd approach
forward = true; forward = true;
buf = curbuf->b_next; buf = curbuf->b_next;
for (;;) { while (true) {
if (buf == NULL) { if (buf == NULL) {
if (!forward) { // tried both directions if (!forward) { // tried both directions
break; break;
@ -2241,7 +2241,7 @@ int buflist_findpat(const char *pattern, const char *pattern_end, bool unlisted,
// First try finding a listed buffer. If not found and "unlisted" // First try finding a listed buffer. If not found and "unlisted"
// is true, try finding an unlisted buffer. // is true, try finding an unlisted buffer.
find_listed = true; find_listed = true;
for (;;) { while (true) {
for (attempt = 0; attempt <= 3; attempt++) { for (attempt = 0; attempt <= 3; attempt++) {
// may add '^' and '$' // may add '^' and '$'
if (toggledollar) { if (toggledollar) {
@ -3180,7 +3180,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
bool dontwrite = bt_dontwrite(curbuf); bool dontwrite = bt_dontwrite(curbuf);
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s", vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged() curbufIsChanged()
? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ", ? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
(curbuf->b_flags & BF_NOTEDITED) && !dontwrite (curbuf->b_flags & BF_NOTEDITED) && !dontwrite
? _("[Not edited]") : "", ? _("[Not edited]") : "",
(curbuf->b_flags & BF_NEW) && !dontwrite (curbuf->b_flags & BF_NEW) && !dontwrite
@ -3609,7 +3609,7 @@ void ex_buffer_all(exarg_T *eap)
if (had_tab > 0) { if (had_tab > 0) {
goto_tabpage_tp(first_tabpage, true, true); goto_tabpage_tp(first_tabpage, true, true);
} }
for (;;) { while (true) {
tpnext = curtab->tp_next; tpnext = curtab->tp_next;
for (wp = firstwin; wp != NULL; wp = wpnext) { for (wp = firstwin; wp != NULL; wp = wpnext) {
wpnext = wp->w_next; wpnext = wp->w_next;

View File

@ -607,7 +607,7 @@ struct file_buffer {
int b_p_ai; ///< 'autoindent' int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode int b_p_ai_nopaste; ///< b_p_ai saved for paste mode
char *b_p_bkc; ///< 'backupco char *b_p_bkc; ///< 'backupco
unsigned int b_bkc_flags; ///< flags for 'backupco unsigned b_bkc_flags; ///< flags for 'backupco
int b_p_ci; ///< 'copyindent' int b_p_ci; ///< 'copyindent'
int b_p_bin; ///< 'binary' int b_p_bin; ///< 'binary'
int b_p_bomb; ///< 'bomb' int b_p_bomb; ///< 'bomb'

View File

@ -714,7 +714,7 @@ static int get_fileinfo(buf_T *buf, char *fname, bool overwriting, bool forceit,
} }
static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_old, vim_acl_T acl, static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_old, vim_acl_T acl,
long perm, unsigned int bkc, bool file_readonly, bool forceit, long perm, unsigned bkc, bool file_readonly, bool forceit,
int *backup_copyp, char **backupp, Error_T *err) int *backup_copyp, char **backupp, Error_T *err)
{ {
FileInfo file_info; FileInfo file_info;
@ -1056,7 +1056,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
int whole = (start == 1 && end == buf->b_ml.ml_line_count); int whole = (start == 1 && end == buf->b_ml.ml_line_count);
int write_undo_file = false; int write_undo_file = false;
context_sha256_T sha_ctx; context_sha256_T sha_ctx;
unsigned int bkc = get_bkc_value(buf); unsigned bkc = get_bkc_value(buf);
if (fname == NULL || *fname == NUL) { // safety check if (fname == NULL || *fname == NUL) { // safety check
return FAIL; return FAIL;

View File

@ -950,7 +950,7 @@ int copy_indent(int size, char *src)
// Add tabs required for indent. // Add tabs required for indent.
if (!curbuf->b_p_et) { if (!curbuf->b_p_et) {
for (;;) { while (true) {
tab_pad = tabstop_padding(ind_col, tab_pad = tabstop_padding(ind_col,
curbuf->b_p_ts, curbuf->b_p_ts,
curbuf->b_p_vts_array); curbuf->b_p_vts_array);

View File

@ -990,7 +990,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
&& *get_showbreak_value(wp) == NUL && *get_showbreak_value(wp) == NUL
&& !wp->w_p_bri && !wp->w_p_bri
&& !cts.cts_has_virt_text) { && !cts.cts_has_virt_text) {
for (;;) { while (true) {
head = 0; head = 0;
int c = (uint8_t)(*ptr); int c = (uint8_t)(*ptr);
@ -1034,7 +1034,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
MB_PTR_ADV(ptr); MB_PTR_ADV(ptr);
} }
} else { } else {
for (;;) { while (true) {
// A tab gets expanded, depending on the current column // A tab gets expanded, depending on the current column
// Other things also take up space. // Other things also take up space.
head = 0; head = 0;

View File

@ -351,7 +351,7 @@ void check_cursor_col_win(win_T *win)
{ {
colnr_T oldcol = win->w_cursor.col; colnr_T oldcol = win->w_cursor.col;
colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd; colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd;
unsigned int cur_ve_flags = get_ve_flags(); unsigned cur_ve_flags = get_ve_flags();
colnr_T len = (colnr_T)strlen(ml_get_buf(win->w_buffer, win->w_cursor.lnum, false)); colnr_T len = (colnr_T)strlen(ml_get_buf(win->w_buffer, win->w_cursor.lnum, false));
if (len == 0) { if (len == 0) {

View File

@ -126,7 +126,7 @@ void do_debug(char *cmd)
} }
// Repeat getting a command and executing it. // Repeat getting a command and executing it.
for (;;) { while (true) {
msg_scroll = true; msg_scroll = true;
need_wait_return = false; need_wait_return = false;

View File

@ -86,7 +86,7 @@ void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
} }
if (decor && kv_size(decor->virt_lines)) { if (decor && kv_size(decor->virt_lines)) {
redraw_buf_line_later(buf, row1 + 1 + (decor->virt_lines_above?0:1), true); redraw_buf_line_later(buf, row1 + 1 + (decor->virt_lines_above ? 0 : 1), true);
changed_line_display_buf(buf); changed_line_display_buf(buf);
} }
} }

View File

@ -328,7 +328,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
diff_T *dp = tp->tp_first_diff; diff_T *dp = tp->tp_first_diff;
linenr_T lnum_deleted = line1; // lnum of remaining deletion linenr_T lnum_deleted = line1; // lnum of remaining deletion
for (;;) { while (true) {
// If the change is after the previous diff block and before the next // If the change is after the previous diff block and before the next
// diff block, thus not touching an existing change, create a new diff // diff block, thus not touching an existing change, create a new diff
// block. Don't do this when ex_diffgetput() is busy. // block. Don't do this when ex_diffgetput() is busy.
@ -588,7 +588,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
linenr_T off_org = 0; linenr_T off_org = 0;
linenr_T off_new = 0; linenr_T off_new = 0;
int dir = FORWARD; int dir = FORWARD;
for (;;) { while (true) {
// Repeat until a line is found which is different or the number of // Repeat until a line is found which is different or the number of
// lines has become zero. // lines has become zero.
while (dp->df_count[i_org] > 0) { while (dp->df_count[i_org] > 0) {
@ -1012,7 +1012,7 @@ static int check_external_diff(diffio_T *diffio)
// May try twice, first with "-a" and then without. // May try twice, first with "-a" and then without.
int io_error = false; int io_error = false;
TriState ok = kFalse; TriState ok = kFalse;
for (;;) { while (true) {
ok = kFalse; ok = kFalse;
FILE *fd = os_fopen(diffio->dio_orig.din_fname, "w"); FILE *fd = os_fopen(diffio->dio_orig.din_fname, "w");
@ -1042,7 +1042,7 @@ static int check_external_diff(diffio_T *diffio)
} else { } else {
char linebuf[LBUFLEN]; char linebuf[LBUFLEN];
for (;;) { while (true) {
// For normal diff there must be a line that contains // For normal diff there must be a line that contains
// "1c1". For unified diff "@@ -1 +1 @@". // "1c1". For unified diff "@@ -1 +1 @@".
if (vim_fgets(linebuf, LBUFLEN, fd)) { if (vim_fgets(linebuf, LBUFLEN, fd)) {
@ -1560,7 +1560,7 @@ static bool extract_hunk_internal(diffout_T *dout, diffhunk_T *hunk, int *line_i
// Extract hunk by parsing the diff output from file and calculate the diffstyle. // Extract hunk by parsing the diff output from file and calculate the diffstyle.
static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle) static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
{ {
for (;;) { while (true) {
char line[LBUFLEN]; // only need to hold the diff line char line[LBUFLEN]; // only need to hold the diff line
if (vim_fgets(line, LBUFLEN, fd)) { if (vim_fgets(line, LBUFLEN, fd)) {
return true; // end of file return true; // end of file
@ -1747,7 +1747,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
} }
} }
for (;;) { while (true) {
diffhunk_T hunk = { 0 }; diffhunk_T hunk = { 0 };
bool eof = dio->dio_internal bool eof = dio->dio_internal
? extract_hunk_internal(dout, &hunk, &line_idx) ? extract_hunk_internal(dout, &hunk, &line_idx)
@ -2952,7 +2952,7 @@ void ex_diffgetput(exarg_T *eap)
} }
const int idx_from = eap->cmdidx == CMD_diffget ? idx_other : idx_cur; const int idx_from = eap->cmdidx == CMD_diffget ? idx_other : idx_cur;
const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other; const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other;
// May give the warning for a changed buffer here, which can trigger the // May give the warning for a changed buffer here, which can trigger the
// FileChangedRO autocommand, which may do nasty things and mess // FileChangedRO autocommand, which may do nasty things and mess

View File

@ -2098,7 +2098,7 @@ void ex_loadkeymap(exarg_T *eap)
p_cpo = "C"; p_cpo = "C";
// Get each line of the sourced file, break at the end. // Get each line of the sourced file, break at the end.
for (;;) { while (true) {
char *line = eap->getline(0, eap->cookie, 0, true); char *line = eap->getline(0, eap->cookie, 0, true);
if (line == NULL) { if (line == NULL) {

View File

@ -1516,7 +1516,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
int virt_line_index; int virt_line_index;
int virt_line_offset = -1; int virt_line_offset = -1;
// Repeat for the whole displayed line. // Repeat for the whole displayed line.
for (;;) { while (true) {
int has_match_conc = 0; ///< match wants to conceal int has_match_conc = 0; ///< match wants to conceal
int decor_conceal = 0; int decor_conceal = 0;

View File

@ -1715,7 +1715,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
// bot_start to the first row that needs redrawing. // bot_start to the first row that needs redrawing.
bot_start = 0; bot_start = 0;
int idx = 0; int idx = 0;
for (;;) { while (true) {
wp->w_lines[idx] = wp->w_lines[j]; wp->w_lines[idx] = wp->w_lines[j];
// stop at line that didn't fit, unless it is still // stop at line that didn't fit, unless it is still
// valid (no lines deleted) // valid (no lines deleted)
@ -1828,7 +1828,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
// First compute the actual start and end column. // First compute the actual start and end column.
if (VIsual_mode == Ctrl_V) { if (VIsual_mode == Ctrl_V) {
colnr_T fromc, toc; colnr_T fromc, toc;
unsigned int save_ve_flags = curwin->w_ve_flags; unsigned save_ve_flags = curwin->w_ve_flags;
if (curwin->w_p_lbr) { if (curwin->w_p_lbr) {
curwin->w_ve_flags = VE_ALL; curwin->w_ve_flags = VE_ALL;
@ -1979,7 +1979,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
bool eof = false; // if true, we hit the end of the file bool eof = false; // if true, we hit the end of the file
bool didline = false; // if true, we finished the last line bool didline = false; // if true, we finished the last line
for (;;) { while (true) {
// stop updating when reached the end of the window (check for _past_ // stop updating when reached the end of the window (check for _past_
// the end of the window is at the end of the loop) // the end of the window is at the end of the loop)
if (row == wp->w_grid.rows) { if (row == wp->w_grid.rows) {
@ -2129,7 +2129,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
int x = row + new_rows; int x = row + new_rows;
// move entries in w_lines[] upwards // move entries in w_lines[] upwards
for (;;) { while (true) {
// stop at last valid entry in w_lines[] // stop at last valid entry in w_lines[]
if (i >= wp->w_lines_valid) { if (i >= wp->w_lines_valid) {
wp->w_lines_valid = (int)j; wp->w_lines_valid = (int)j;

View File

@ -1858,7 +1858,7 @@ int get_literal(bool no_simplify)
no_mapping++; // don't map the next key hits no_mapping++; // don't map the next key hits
cc = 0; cc = 0;
i = 0; i = 0;
for (;;) { while (true) {
nc = plain_vgetc(); nc = plain_vgetc();
if (!no_simplify) { if (!no_simplify) {
nc = merge_modifiers(nc, &mod_mask); nc = merge_modifiers(nc, &mod_mask);
@ -2356,7 +2356,7 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
curwin->w_cursor = *end_insert_pos; curwin->w_cursor = *end_insert_pos;
check_cursor_col(); // make sure it is not past the line check_cursor_col(); // make sure it is not past the line
for (;;) { while (true) {
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) { if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) {
curwin->w_cursor.col--; curwin->w_cursor.col--;
} }
@ -2505,7 +2505,7 @@ int oneleft(void)
// We might get stuck on 'showbreak', skip over it. // We might get stuck on 'showbreak', skip over it.
width = 1; width = 1;
for (;;) { while (true) {
coladvance(v - width); coladvance(v - width);
// getviscol() is slow, skip it when 'showbreak' is empty, // getviscol() is slow, skip it when 'showbreak' is empty,
// 'breakindent' is not set and there are no multi-byte // 'breakindent' is not set and there are no multi-byte
@ -2886,7 +2886,7 @@ static void mb_replace_pop_ins(int cc)
} }
// Handle composing chars. // Handle composing chars.
for (;;) { while (true) {
int c = replace_pop(); int c = replace_pop();
if (c == -1) { // stack empty if (c == -1) { // stack empty
break; break;

View File

@ -2082,7 +2082,7 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
|| cmdidx == CMD_echon || cmdidx == CMD_echon
|| cmdidx == CMD_echomsg) || cmdidx == CMD_echomsg)
&& xp->xp_context == EXPAND_EXPRESSION) { && xp->xp_context == EXPAND_EXPRESSION) {
for (;;) { while (true) {
char *const n = skiptowhite(arg); char *const n = skiptowhite(arg);
if (n == arg || ascii_iswhite_or_nul(*skipwhite(n))) { if (n == arg || ascii_iswhite_or_nul(*skipwhite(n))) {
@ -2780,7 +2780,7 @@ static int eval5(char **arg, typval_T *rettv, evalarg_T *const evalarg)
} }
// Repeat computing, until no '+', '-' or '.' is following. // Repeat computing, until no '+', '-' or '.' is following.
for (;;) { while (true) {
int op = (uint8_t)(**arg); int op = (uint8_t)(**arg);
bool concat = op == '.'; bool concat = op == '.';
if (op != '+' && op != '-' && !concat) { if (op != '+' && op != '-' && !concat) {
@ -2924,7 +2924,7 @@ static int eval6(char **arg, typval_T *rettv, evalarg_T *const evalarg, bool wan
} }
// Repeat computing, until no '*', '/' or '%' is following. // Repeat computing, until no '*', '/' or '%' is following.
for (;;) { while (true) {
int op = (uint8_t)(**arg); int op = (uint8_t)(**arg);
if (op != '*' && op != '/' && op != '%') { if (op != '*' && op != '/' && op != '%') {
break; break;
@ -3920,7 +3920,7 @@ static int eval_string(char **arg, typval_T *rettv, bool evaluate, bool interpol
{ {
char *p; char *p;
const char *const arg_end = *arg + strlen(*arg); const char *const arg_end = *arg + strlen(*arg);
unsigned int extra = interpolate ? 1 : 0; unsigned extra = interpolate ? 1 : 0;
const int off = interpolate ? 0 : 1; const int off = interpolate ? 0 : 1;
// Find the end of the string, skipping backslashed characters. // Find the end of the string, skipping backslashed characters.
@ -4175,7 +4175,7 @@ int eval_interp_string(char **arg, typval_T *rettv, bool evaluate)
const int quote = (uint8_t)(**arg); const int quote = (uint8_t)(**arg);
(*arg)++; (*arg)++;
for (;;) { while (true) {
typval_T tv; typval_T tv;
// Get the string up to the matching quote or to a single '{'. // Get the string up to the matching quote or to a single '{'.
// "arg" is advanced to either the quote or the '{'. // "arg" is advanced to either the quote or the '{'.
@ -4686,7 +4686,7 @@ bool set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack)
ht_stack_T *ht_stack = NULL; ht_stack_T *ht_stack = NULL;
hashtab_T *cur_ht = ht; hashtab_T *cur_ht = ht;
for (;;) { while (true) {
if (!abort) { if (!abort) {
// Mark each item in the hashtab. If the item contains a hashtab // Mark each item in the hashtab. If the item contains a hashtab
// it is added to ht_stack, if it contains a list it is added to // it is added to ht_stack, if it contains a list it is added to
@ -4724,7 +4724,7 @@ bool set_ref_in_list(list_T *l, int copyID, ht_stack_T **ht_stack)
list_stack_T *list_stack = NULL; list_stack_T *list_stack = NULL;
list_T *cur_l = l; list_T *cur_l = l;
for (;;) { while (true) {
// Mark each item in the list. If the item contains a hashtab // Mark each item in the list. If the item contains a hashtab
// it is added to ht_stack, if it contains a list it is added to // it is added to ht_stack, if it contains a list it is added to
// list_stack. // list_stack.
@ -6514,7 +6514,7 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret
} }
pos = fm->mark; pos = fm->mark;
// Vimscript behavior, only provide fnum if mark is global. // Vimscript behavior, only provide fnum if mark is global.
*ret_fnum = ASCII_ISUPPER(mname) || ascii_isdigit(mname) ? fm->fnum: *ret_fnum; *ret_fnum = ASCII_ISUPPER(mname) || ascii_isdigit(mname) ? fm->fnum : *ret_fnum;
} }
if (pos.lnum != 0) { if (pos.lnum != 0) {
if (charcol) { if (charcol) {
@ -7162,7 +7162,7 @@ char *set_cmdarg(exarg_T *eap, char *oldarg)
rc = snprintf(newval + xlen, rc = snprintf(newval + xlen,
newval_len - xlen, newval_len - xlen,
" ++ff=%s", " ++ff=%s",
eap->force_ff == 'u' ? "unix" eap->force_ff == 'u' ? "unix"
: eap->force_ff == 'd' ? "dos" : "mac"); : eap->force_ff == 'd' ? "dos" : "mac");
if (rc < 0) { if (rc < 0) {
goto error; goto error;

View File

@ -172,7 +172,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, typval_
} }
// Default result is zero == OK. // Default result is zero == OK.
for (;;) { while (true) {
if (lines->v_type == VAR_LIST) { if (lines->v_type == VAR_LIST) {
// List argument, get next string. // List argument, get next string.
if (li == NULL) { if (li == NULL) {

View File

@ -418,7 +418,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
ga_concat(gap, "v:null") ga_concat(gap, "v:null")
#define TYPVAL_ENCODE_CONV_BOOL(tv, num) \ #define TYPVAL_ENCODE_CONV_BOOL(tv, num) \
ga_concat(gap, ((num)? "v:true": "v:false")) ga_concat(gap, ((num) ? "v:true" : "v:false"))
#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(tv, num) #define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(tv, num)
@ -544,7 +544,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
#undef TYPVAL_ENCODE_CONV_BOOL #undef TYPVAL_ENCODE_CONV_BOOL
#define TYPVAL_ENCODE_CONV_BOOL(tv, num) \ #define TYPVAL_ENCODE_CONV_BOOL(tv, num) \
ga_concat(gap, ((num)? "true": "false")) ga_concat(gap, ((num) ? "true" : "false"))
#undef TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER #undef TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(tv, num) \ #define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(tv, num) \

View File

@ -643,7 +643,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
bool crlf = false; bool crlf = false;
#else #else
Channel *chan = find_channel(id); Channel *chan = find_channel(id);
bool crlf = (chan != NULL && chan->term) ? true: false; bool crlf = (chan != NULL && chan->term) ? true : false;
#endif #endif
if (argvars[1].v_type == VAR_BLOB) { if (argvars[1].v_type == VAR_BLOB) {
@ -4593,7 +4593,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
if (regmatch.regprog != NULL) { if (regmatch.regprog != NULL) {
regmatch.rm_ic = p_ic; regmatch.rm_ic = p_ic;
for (;;) { while (true) {
if (l != NULL) { if (l != NULL) {
if (li == NULL) { if (li == NULL) {
match = false; match = false;
@ -4960,7 +4960,7 @@ static void msgpackparse_unpack_list(const list_T *const list, list_T *const ret
} }
msgpack_unpacked unpacked; msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked); msgpack_unpacked_init(&unpacked);
do { while (true) {
if (!msgpack_unpacker_reserve_buffer(unpacker, IOSIZE)) { if (!msgpack_unpacker_reserve_buffer(unpacker, IOSIZE)) {
emsg(_(e_outofmem)); emsg(_(e_outofmem));
goto end; goto end;
@ -4990,7 +4990,7 @@ static void msgpackparse_unpack_list(const list_T *const list, list_T *const ret
if (rlret == OK) { if (rlret == OK) {
break; break;
} }
} while (true); }
end: end:
msgpack_unpacker_free(unpacker); msgpack_unpacker_free(unpacker);
@ -6026,8 +6026,8 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
char *const buf = xmallocz(MAXPATHL); char *const buf = xmallocz(MAXPATHL);
char *cpy; char *cpy;
for (;;) { while (true) {
for (;;) { while (true) {
len = readlink(p, buf, MAXPATHL); len = readlink(p, buf, MAXPATHL);
if (len <= 0) { if (len <= 0) {
break; break;
@ -6409,7 +6409,7 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
int subpatnum; int subpatnum;
// Repeat until {skip} returns false. // Repeat until {skip} returns false.
for (;;) { while (true) {
subpatnum subpatnum
= searchit(curwin, curbuf, &pos, NULL, dir, (char *)pat, 1, options, RE_SEARCH, &sia); = searchit(curwin, curbuf, &pos, NULL, dir, (char *)pat, 1, options, RE_SEARCH, &sia);
// finding the first match again means there is no match where {skip} // finding the first match again means there is no match where {skip}
@ -6989,7 +6989,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
pos_T foundpos; pos_T foundpos;
clearpos(&foundpos); clearpos(&foundpos);
char *pat = pat3; char *pat = pat3;
for (;;) { while (true) {
searchit_arg_T sia = { searchit_arg_T sia = {
.sa_stop_lnum = lnum_stop, .sa_stop_lnum = lnum_stop,
.sa_tm = &tm, .sa_tm = &tm,

View File

@ -1042,7 +1042,7 @@ static int item_compare(const void *s1, const void *s2, bool keep_zero)
if (sortinfo->item_compare_lc) { if (sortinfo->item_compare_lc) {
res = strcoll(p1, p2); res = strcoll(p1, p2);
} else { } else {
res = sortinfo->item_compare_ic ? STRICMP(p1, p2): strcmp(p1, p2); res = sortinfo->item_compare_ic ? STRICMP(p1, p2) : strcmp(p1, p2);
} }
} else { } else {
double n1, n2; double n1, n2;

View File

@ -2343,7 +2343,7 @@ void ex_function(exarg_T *eap)
} }
// find extra arguments "range", "dict", "abort" and "closure" // find extra arguments "range", "dict", "abort" and "closure"
for (;;) { while (true) {
p = skipwhite(p); p = skipwhite(p);
if (strncmp(p, "range", 5) == 0) { if (strncmp(p, "range", 5) == 0) {
flags |= FC_RANGE; flags |= FC_RANGE;
@ -2403,7 +2403,7 @@ void ex_function(exarg_T *eap)
indent = 2; indent = 2;
nesting = 0; nesting = 0;
for (;;) { while (true) {
if (KeyTyped) { if (KeyTyped) {
msg_scroll = true; msg_scroll = true;
saved_wait_return = false; saved_wait_return = false;

View File

@ -220,7 +220,7 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
char *theline = NULL; char *theline = NULL;
list_T *l = tv_list_alloc(0); list_T *l = tv_list_alloc(0);
for (;;) { while (true) {
int mi = 0; int mi = 0;
int ti = 0; int ti = 0;
@ -502,7 +502,7 @@ const char *skip_var_list(const char *arg, int *var_count, int *semicolon)
const char *s; const char *s;
// "[var, var]": find the matching ']'. // "[var, var]": find the matching ']'.
const char *p = arg; const char *p = arg;
for (;;) { while (true) {
p = skipwhite(p + 1); // skip whites after '[', ';' or ',' p = skipwhite(p + 1); // skip whites after '[', ';' or ','
s = skip_var_one(p); s = skip_var_one(p);
if (s == p) { if (s == p) {
@ -1012,7 +1012,7 @@ static int do_unlet_var(lval_T *lp, char *name_end, exarg_T *eap, int deep FUNC_
// Delete a range of List items. // Delete a range of List items.
listitem_T *const first_li = lp->ll_li; listitem_T *const first_li = lp->ll_li;
listitem_T *last_li = first_li; listitem_T *last_li = first_li;
for (;;) { while (true) {
listitem_T *const li = TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li); listitem_T *const li = TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li);
if (value_check_lock(TV_LIST_ITEM_TV(lp->ll_li)->v_lock, if (value_check_lock(TV_LIST_ITEM_TV(lp->ll_li)->v_lock,
lp->ll_name, lp->ll_name,

View File

@ -1402,7 +1402,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
: 0; : 0;
if (itmp != NULL) { if (itmp != NULL) {
len += is_pwsh ? strlen(itmp) + sizeof("& { Get-Content " " | & " " }") - 1 + 6 // +6: #20530 len += is_pwsh ? strlen(itmp) + sizeof("& { Get-Content " " | & " " }") - 1 + 6 // +6: #20530
: strlen(itmp) + sizeof(" { " " < " " } ") - 1; : strlen(itmp) + sizeof(" { " " < " " } ") - 1;
} }
if (otmp != NULL) { if (otmp != NULL) {
@ -1427,7 +1427,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
// redirecting input and/or output. // redirecting input and/or output.
if (itmp != NULL || otmp != NULL) { if (itmp != NULL || otmp != NULL) {
char *fmt = is_fish_shell ? "begin; %s; end" char *fmt = is_fish_shell ? "begin; %s; end"
: "(%s)"; : "(%s)";
vim_snprintf(buf, len, fmt, cmd); vim_snprintf(buf, len, fmt, cmd);
} else { } else {
xstrlcpy(buf, cmd, len); xstrlcpy(buf, cmd, len);
@ -2782,7 +2782,7 @@ void ex_append(exarg_T *eap)
State |= MODE_LANGMAP; State |= MODE_LANGMAP;
} }
for (;;) { while (true) {
msg_scroll = true; msg_scroll = true;
need_wait_return = false; need_wait_return = false;
if (curbuf->b_p_ai) { if (curbuf->b_p_ai) {
@ -3581,7 +3581,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
// 3. substitute the string. // 3. substitute the string.
// 4. if subflags.do_all is set, find next match // 4. if subflags.do_all is set, find next match
// 5. break if there isn't another match in this line // 5. break if there isn't another match in this line
for (;;) { while (true) {
SubResult current_match = { SubResult current_match = {
.start = { 0, 0 }, .start = { 0, 0 },
.end = { 0, 0 }, .end = { 0, 0 },

View File

@ -2371,7 +2371,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, bool
CLEAR_POINTER(cmod); CLEAR_POINTER(cmod);
// Repeat until no more command modifiers are found. // Repeat until no more command modifiers are found.
for (;;) { while (true) {
while (*eap->cmd == ' ' while (*eap->cmd == ' '
|| *eap->cmd == '\t' || *eap->cmd == '\t'
|| *eap->cmd == ':') { || *eap->cmd == ':') {
@ -2700,7 +2700,7 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent)
int ret = FAIL; int ret = FAIL;
// Repeat for all ',' or ';' separated addresses. // Repeat for all ',' or ';' separated addresses.
for (;;) { while (true) {
eap->line1 = eap->line2; eap->line1 = eap->line2;
eap->line2 = get_cmd_default_range(eap); eap->line2 = get_cmd_default_range(eap);
eap->cmd = skipwhite(eap->cmd); eap->cmd = skipwhite(eap->cmd);
@ -3464,7 +3464,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
} }
} }
for (;;) { while (true) {
cmd = skipwhite(cmd); cmd = skipwhite(cmd);
if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) { if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) {
break; break;
@ -6577,7 +6577,7 @@ static void ex_findpat(exarg_T *eap)
} }
if (!eap->skip) { if (!eap->skip) {
find_pattern_in_path(eap->arg, 0, strlen(eap->arg), whole, !eap->forceit, find_pattern_in_path(eap->arg, 0, strlen(eap->arg), whole, !eap->forceit,
*eap->cmd == 'd' ? FIND_DEFINE : FIND_ANY, *eap->cmd == 'd' ? FIND_DEFINE : FIND_ANY,
n, action, eap->line1, eap->line2); n, action, eap->line1, eap->line2);
} }
} }
@ -7110,7 +7110,7 @@ static void ex_filetype(exarg_T *eap)
bool indent = false; bool indent = false;
// Accept "plugin" and "indent" in any order. // Accept "plugin" and "indent" in any order.
for (;;) { while (true) {
if (strncmp(arg, "plugin", 6) == 0) { if (strncmp(arg, "plugin", 6) == 0) {
plugin = true; plugin = true;
arg = skipwhite(arg + 6); arg = skipwhite(arg + 6);

View File

@ -1484,8 +1484,8 @@ void ex_finally(exarg_T *eap)
} else { } else {
pending |= (did_throw ? CSTP_THROW : 0); pending |= (did_throw ? CSTP_THROW : 0);
} }
pending |= did_emsg ? CSTP_ERROR : 0; pending |= did_emsg ? CSTP_ERROR : 0;
pending |= got_int ? CSTP_INTERRUPT : 0; pending |= got_int ? CSTP_INTERRUPT : 0;
assert(pending >= CHAR_MIN && pending <= CHAR_MAX); assert(pending >= CHAR_MIN && pending <= CHAR_MAX);
cstack->cs_pending[cstack->cs_idx] = (char)pending; cstack->cs_pending[cstack->cs_idx] = (char)pending;
@ -1973,7 +1973,7 @@ void ex_endfunction(exarg_T *eap)
int has_loop_cmd(char *p) int has_loop_cmd(char *p)
{ {
// skip modifiers, white space and ':' // skip modifiers, white space and ':'
for (;;) { while (true) {
while (*p == ' ' || *p == '\t' || *p == ':') { while (*p == ' ' || *p == '\t' || *p == ':') {
p++; p++;
} }

View File

@ -1651,7 +1651,7 @@ static void command_line_left_right_mouse(CommandLineState *s)
static void command_line_next_histidx(CommandLineState *s, bool next_match) static void command_line_next_histidx(CommandLineState *s, bool next_match)
{ {
int j = (int)strlen(s->lookfor); int j = (int)strlen(s->lookfor);
for (;;) { while (true) {
// one step backwards // one step backwards
if (!next_match) { if (!next_match) {
if (s->hiscnt == get_hislen()) { if (s->hiscnt == get_hislen()) {
@ -4574,7 +4574,7 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
} }
const char *const end_pattern = (cmd[2] != NUL ? skipwhite(cmd + 2) : "."); const char *const end_pattern = (cmd[2] != NUL ? skipwhite(cmd + 2) : ".");
for (;;) { while (true) {
char *const theline = eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL, eap->cookie, 0, char *const theline = eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL, eap->cookie, 0,
true); true);

View File

@ -576,9 +576,9 @@ char *vim_findfile(void *search_ctx_arg)
} }
// upward search loop // upward search loop
for (;;) { while (true) {
// downward search loop // downward search loop
for (;;) { while (true) {
// check if user wants to stop the search // check if user wants to stop the search
os_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
@ -780,7 +780,7 @@ char *vim_findfile(void *search_ctx_arg)
} else { } else {
suf = curbuf->b_p_sua; suf = curbuf->b_p_sua;
} }
for (;;) { while (true) {
// if file exists and we didn't already find it // if file exists and we didn't already find it
if ((path_with_url(file_path) if ((path_with_url(file_path)
|| (os_path_exists(file_path) || (os_path_exists(file_path)
@ -1419,7 +1419,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
// When the file doesn't exist, try adding parts of 'suffixesadd'. // When the file doesn't exist, try adding parts of 'suffixesadd'.
buf = suffixes; buf = suffixes;
for (;;) { while (true) {
if ((os_path_exists(NameBuff) if ((os_path_exists(NameBuff)
&& (find_what == FINDFILE_BOTH && (find_what == FINDFILE_BOTH
|| ((find_what == FINDFILE_DIR) || ((find_what == FINDFILE_DIR)
@ -1446,7 +1446,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
did_findfile_init = false; did_findfile_init = false;
} }
for (;;) { while (true) {
if (did_findfile_init) { if (did_findfile_init) {
file_name = vim_findfile(*search_ctx); file_name = vim_findfile(*search_ctx);
if (file_name != NULL) { if (file_name != NULL) {

View File

@ -943,7 +943,7 @@ retry:
} else { } else {
int ni; int ni;
long tlen = 0; long tlen = 0;
for (;;) { while (true) {
p = (uint8_t *)ml_get(read_buf_lnum) + read_buf_col; p = (uint8_t *)ml_get(read_buf_lnum) + read_buf_col;
int n = (int)strlen((char *)p); int n = (int)strlen((char *)p);
if ((int)tlen + n + 1 > size) { if ((int)tlen + n + 1 > size) {
@ -1141,7 +1141,7 @@ retry:
} }
if (fio_flags != 0) { if (fio_flags != 0) {
unsigned int u8c; unsigned u8c;
char *dest; char *dest;
char *tail = NULL; char *tail = NULL;
@ -3360,7 +3360,7 @@ int readdir_core(garray_T *gap, const char *path, void *context, CheckItem check
return FAIL; return FAIL;
} }
for (;;) { while (true) {
const char *p = os_scandir_next(&dir); const char *p = os_scandir_next(&dir);
if (p == NULL) { if (p == NULL) {
break; break;
@ -3820,8 +3820,8 @@ long read_eintr(int fd, void *buf, size_t bufsize)
{ {
long ret; long ret;
for (;;) { while (true) {
ret = read(fd, buf, (unsigned int)bufsize); ret = read(fd, buf, (unsigned)bufsize);
if (ret >= 0 || errno != EINTR) { if (ret >= 0 || errno != EINTR) {
break; break;
} }
@ -3838,7 +3838,7 @@ long write_eintr(int fd, void *buf, size_t bufsize)
// Repeat the write() so long it didn't fail, other than being interrupted // Repeat the write() so long it didn't fail, other than being interrupted
// by a signal. // by a signal.
while (ret < (long)bufsize) { while (ret < (long)bufsize) {
long wlen = write(fd, (char *)buf + ret, (unsigned int)(bufsize - (size_t)ret)); long wlen = write(fd, (char *)buf + ret, (unsigned)(bufsize - (size_t)ret));
if (wlen < 0) { if (wlen < 0) {
if (errno != EINTR) { if (errno != EINTR) {
break; break;

View File

@ -201,7 +201,7 @@ bool hasFoldingWin(win_T *const win, const linenr_T lnum, linenr_T *const firstp
if (first == 0) { if (first == 0) {
// Recursively search for a fold that contains "lnum". // Recursively search for a fold that contains "lnum".
garray_T *gap = &win->w_folds; garray_T *gap = &win->w_folds;
for (;;) { while (true) {
if (!foldFind(gap, lnum_rel, &fp)) { if (!foldFind(gap, lnum_rel, &fp)) {
break; break;
} }
@ -430,7 +430,7 @@ void foldOpenCursor(void)
{ {
checkupdate(curwin); checkupdate(curwin);
if (hasAnyFolding(curwin)) { if (hasAnyFolding(curwin)) {
for (;;) { while (true) {
int done = DONE_NOTHING; int done = DONE_NOTHING;
(void)setManualFold(curwin->w_cursor, true, false, &done); (void)setManualFold(curwin->w_cursor, true, false, &done);
if (!(done & DONE_ACTION)) { if (!(done & DONE_ACTION)) {
@ -562,7 +562,7 @@ void foldCreate(win_T *wp, pos_T start, pos_T end)
i = 0; i = 0;
} else { } else {
fold_T *fp; fold_T *fp;
for (;;) { while (true) {
if (!foldFind(gap, start_rel.lnum, &fp)) { if (!foldFind(gap, start_rel.lnum, &fp)) {
break; break;
} }
@ -683,7 +683,7 @@ void deleteFold(win_T *const wp, const linenr_T start, const linenr_T end, const
garray_T *found_ga = NULL; garray_T *found_ga = NULL;
linenr_T lnum_off = 0; linenr_T lnum_off = 0;
bool use_level = false; bool use_level = false;
for (;;) { while (true) {
fold_T *fp; fold_T *fp;
if (!foldFind(gap, lnum - lnum_off, &fp)) { if (!foldFind(gap, lnum - lnum_off, &fp)) {
break; break;
@ -865,7 +865,7 @@ int foldMoveTo(const bool updown, const int dir, const long count)
linenr_T lnum_found = curwin->w_cursor.lnum; linenr_T lnum_found = curwin->w_cursor.lnum;
int level = 0; int level = 0;
bool last = false; bool last = false;
for (;;) { while (true) {
if (!foldFind(gap, curwin->w_cursor.lnum - lnum_off, &fp)) { if (!foldFind(gap, curwin->w_cursor.lnum - lnum_off, &fp)) {
if (!updown || gap->ga_len == 0) { if (!updown || gap->ga_len == 0) {
break; break;
@ -1104,7 +1104,7 @@ static int foldLevelWin(win_T *wp, linenr_T lnum)
// Recursively search for a fold that contains "lnum". // Recursively search for a fold that contains "lnum".
garray_T *gap = &wp->w_folds; garray_T *gap = &wp->w_folds;
for (;;) { while (true) {
if (!foldFind(gap, lnum_rel, &fp)) { if (!foldFind(gap, lnum_rel, &fp)) {
break; break;
} }
@ -1201,7 +1201,7 @@ static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, int opening, int recu
// Find the fold, open or close it. // Find the fold, open or close it.
garray_T *gap = &wp->w_folds; garray_T *gap = &wp->w_folds;
for (;;) { while (true) {
if (!foldFind(gap, lnum, &fp)) { if (!foldFind(gap, lnum, &fp)) {
// If there is a following fold, continue there next time. // If there is a following fold, continue there next time.
if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len) { if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len) {
@ -2509,7 +2509,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
} }
// delete following folds that end before the current line // delete following folds that end before the current line
for (;;) { while (true) {
fp2 = fp + 1; fp2 = fp + 1;
if (fp2 >= (fold_T *)gap->ga_data + gap->ga_len if (fp2 >= (fold_T *)gap->ga_data + gap->ga_len
|| fp2->fd_top > flp->lnum) { || fp2->fd_top > flp->lnum) {

View File

@ -973,7 +973,7 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
int ins_char_typebuf(int c, int modifiers) int ins_char_typebuf(int c, int modifiers)
{ {
char buf[MB_MAXBYTES * 3 + 4]; char buf[MB_MAXBYTES * 3 + 4];
unsigned int len = special_to_buf(c, modifiers, true, buf); unsigned len = special_to_buf(c, modifiers, true, buf);
assert(len < sizeof(buf)); assert(len < sizeof(buf));
buf[len] = NUL; buf[len] = NUL;
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent); (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
@ -1432,7 +1432,7 @@ int vgetc(void)
// if peeking records more // if peeking records more
last_recorded_len -= last_vgetc_recorded_len; last_recorded_len -= last_vgetc_recorded_len;
for (;;) { // this is done twice if there are modifiers while (true) { // this is done twice if there are modifiers
bool did_inc = false; bool did_inc = false;
if (mod_mask) { // no mapping after modifier has been read if (mod_mask) { // no mapping after modifier has been read
no_mapping++; no_mapping++;
@ -1670,7 +1670,7 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
no_mapping++; no_mapping++;
allow_keys++; allow_keys++;
for (;;) { while (true) {
if (msg_col > 0) { if (msg_col > 0) {
// Position the cursor. Needed after a message that ends in a space. // Position the cursor. Needed after a message that ends in a space.
ui_cursor_goto(msg_row, msg_col); ui_cursor_goto(msg_row, msg_col);
@ -2363,7 +2363,7 @@ static int vgetorpeek(bool advance)
// are sure that it is not a mapped key. // are sure that it is not a mapped key.
// If a mapped key sequence is found we go back to the start to // If a mapped key sequence is found we go back to the start to
// try re-mapping. // try re-mapping.
for (;;) { while (true) {
check_end_reg_executing(advance); check_end_reg_executing(advance);
// os_breakcheck() is slow, don't use it too often when // os_breakcheck() is slow, don't use it too often when
// inside a mapping. But call it each time for typed // inside a mapping. But call it each time for typed
@ -2694,7 +2694,7 @@ static int vgetorpeek(bool advance)
typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES;
} }
} }
} // for (;;) } // while (true)
} // if (!character from stuffbuf) } // if (!character from stuffbuf)
// if advance is false don't loop on NULs // if advance is false don't loop on NULs
@ -2813,7 +2813,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time)
#define DUM_LEN (MAXMAPLEN * 3 + 3) #define DUM_LEN (MAXMAPLEN * 3 + 3)
uint8_t dum[DUM_LEN + 1]; uint8_t dum[DUM_LEN + 1];
for (;;) { while (true) {
len = os_inchar(dum, DUM_LEN, 0L, 0, NULL); len = os_inchar(dum, DUM_LEN, 0L, 0, NULL);
if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) { if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) {
break; break;

View File

@ -65,7 +65,7 @@ void hash_clear(hashtab_T *ht)
/// Free the array of a hash table and all contained values. /// Free the array of a hash table and all contained values.
/// ///
/// @param off the offset from start of value to start of key (@see hashitem_T). /// @param off the offset from start of value to start of key (@see hashitem_T).
void hash_clear_all(hashtab_T *ht, unsigned int off) void hash_clear_all(hashtab_T *ht, unsigned off)
{ {
size_t todo = ht->ht_used; size_t todo = ht->ht_used;
for (hashitem_T *hi = ht->ht_array; todo > 0; hi++) { for (hashitem_T *hi = ht->ht_array; todo > 0; hi++) {

View File

@ -527,7 +527,7 @@ int set_indent(int size, int flags)
} }
// Count tabs required for indent. // Count tabs required for indent.
for (;;) { while (true) {
tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts, curbuf->b_p_vts_array); tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts, curbuf->b_p_vts_array);
if (todo < tab_pad) { if (todo < tab_pad) {
break; break;
@ -650,7 +650,7 @@ int set_indent(int size, int flags)
p = skipwhite(p); p = skipwhite(p);
} }
for (;;) { while (true) {
tab_pad = tabstop_padding(ind_done, tab_pad = tabstop_padding(ind_done,
curbuf->b_p_ts, curbuf->b_p_ts,
curbuf->b_p_vts_array); curbuf->b_p_vts_array);
@ -980,7 +980,7 @@ void ex_retab(exarg_T *eap)
long col = 0; long col = 0;
long vcol = 0; long vcol = 0;
bool did_undo = false; // called u_save for current line bool did_undo = false; // called u_save for current line
for (;;) { while (true) {
if (ascii_iswhite(ptr[col])) { if (ascii_iswhite(ptr[col])) {
if (!got_tab && num_spaces == 0) { if (!got_tab && num_spaces == 0) {
// First consecutive white-space // First consecutive white-space

View File

@ -47,7 +47,7 @@ pos_T *find_start_comment(int ind_maxcomment) // XXX
pos_T *pos; pos_T *pos;
int64_t cur_maxcomment = ind_maxcomment; int64_t cur_maxcomment = ind_maxcomment;
for (;;) { while (true) {
pos = findmatchlimit(NULL, '*', FM_BACKWARD, cur_maxcomment); pos = findmatchlimit(NULL, '*', FM_BACKWARD, cur_maxcomment);
if (pos == NULL) { if (pos == NULL) {
break; break;
@ -108,7 +108,7 @@ static pos_T *find_start_rawstring(int ind_maxcomment) // XXX
pos_T *pos; pos_T *pos;
long cur_maxcomment = ind_maxcomment; long cur_maxcomment = ind_maxcomment;
for (;;) { while (true) {
pos = findmatchlimit(NULL, 'R', FM_BACKWARD, cur_maxcomment); pos = findmatchlimit(NULL, 'R', FM_BACKWARD, cur_maxcomment);
if (pos == NULL) { if (pos == NULL) {
break; break;
@ -412,7 +412,7 @@ static int cin_isinit(void)
s = cin_skipcomment(s + 7); s = cin_skipcomment(s + 7);
} }
for (;;) { while (true) {
int i, l; int i, l;
for (i = 0; i < (int)ARRAY_SIZE(skip); i++) { for (i = 0; i < (int)ARRAY_SIZE(skip); i++) {
@ -756,7 +756,7 @@ static int cin_ispreproc_cont(const char **pp, linenr_T *lnump, int *amount)
candidate_amount = get_indent_lnum(lnum); candidate_amount = get_indent_lnum(lnum);
} }
for (;;) { while (true) {
if (cin_ispreproc(line)) { if (cin_ispreproc(line)) {
retval = true; retval = true;
*lnump = lnum; *lnump = lnum;
@ -929,7 +929,7 @@ static int cin_isfuncdecl(const char **sp, linenr_T first_lnum, linenr_T min_lnu
// At the end: check for ',' in the next line, for this style: // At the end: check for ',' in the next line, for this style:
// func(arg1 // func(arg1
// , arg2) // , arg2)
for (;;) { while (true) {
if (lnum >= curbuf->b_ml.ml_line_count) { if (lnum >= curbuf->b_ml.ml_line_count) {
break; break;
} }
@ -1186,7 +1186,7 @@ static int cin_is_cpp_baseclass(cpp_baseclass_cache_T *cached)
pos->lnum = lnum; pos->lnum = lnum;
line = ml_get(lnum); line = ml_get(lnum);
s = line; s = line;
for (;;) { while (true) {
if (*s == NUL) { if (*s == NUL) {
if (lnum == curwin->w_cursor.lnum) { if (lnum == curwin->w_cursor.lnum) {
break; break;
@ -2501,7 +2501,7 @@ int get_c_indent(void)
// the usual amount relative to the conditional // the usual amount relative to the conditional
// that opens the block. // that opens the block.
curwin->w_cursor = cur_curpos; curwin->w_cursor = cur_curpos;
for (;;) { while (true) {
curwin->w_cursor.lnum--; curwin->w_cursor.lnum--;
curwin->w_cursor.col = 0; curwin->w_cursor.col = 0;

View File

@ -93,7 +93,7 @@ int get_keystroke(MultiQueue *events)
int save_mapped_ctrl_c = mapped_ctrl_c; int save_mapped_ctrl_c = mapped_ctrl_c;
mapped_ctrl_c = 0; // mappings are not used here mapped_ctrl_c = 0; // mappings are not used here
for (;;) { while (true) {
// flush output before waiting // flush output before waiting
ui_flush(); ui_flush();
// Leave some room for check_termcode() to insert a key code into (max // Leave some room for check_termcode() to insert a key code into (max
@ -179,7 +179,7 @@ int get_number(int colon, int *mouse_used)
no_mapping++; no_mapping++;
allow_keys++; // no mapping here, but recognize keys allow_keys++; // no mapping here, but recognize keys
for (;;) { while (true) {
ui_cursor_goto(msg_row, msg_col); ui_cursor_goto(msg_row, msg_col);
int c = safe_vgetc(); int c = safe_vgetc();
if (ascii_isdigit(c)) { if (ascii_isdigit(c)) {

View File

@ -3147,7 +3147,7 @@ static int get_next_default_completion(ins_compl_next_state_T *st, pos_T *start_
} }
bool looped_around = false; bool looped_around = false;
int found_new_match = FAIL; int found_new_match = FAIL;
for (;;) { while (true) {
bool cont_s_ipos = false; bool cont_s_ipos = false;
msg_silent++; // Don't want messages for wrapscan. msg_silent++; // Don't want messages for wrapscan.
@ -3311,7 +3311,7 @@ static int ins_compl_get_exp(pos_T *ini)
st.cur_match_pos = compl_dir_forward() ? &st.last_match_pos : &st.first_match_pos; st.cur_match_pos = compl_dir_forward() ? &st.last_match_pos : &st.first_match_pos;
// For ^N/^P loop over all the flags/windows/buffers in 'complete' // For ^N/^P loop over all the flags/windows/buffers in 'complete'
for (;;) { while (true) {
found_new_match = FAIL; found_new_match = FAIL;
st.set_match_pos = false; st.set_match_pos = false;

View File

@ -572,8 +572,8 @@ char *get_special_key_name(int c, int modifiers)
/// @param[out] did_simplify found <C-H>, etc. /// @param[out] did_simplify found <C-H>, etc.
/// ///
/// @return Number of characters added to dst, zero for no match. /// @return Number of characters added to dst, zero for no match.
unsigned int trans_special(const char **const srcp, const size_t src_len, char *const dst, unsigned trans_special(const char **const srcp, const size_t src_len, char *const dst,
const int flags, const bool escape_ks, bool *const did_simplify) const int flags, const bool escape_ks, bool *const did_simplify)
FUNC_ATTR_NONNULL_ARG(1, 3) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1, 3) FUNC_ATTR_WARN_UNUSED_RESULT
{ {
int modifiers = 0; int modifiers = 0;
@ -590,9 +590,9 @@ unsigned int trans_special(const char **const srcp, const size_t src_len, char *
/// When "escape_ks" is true escape K_SPECIAL bytes in the character. /// When "escape_ks" is true escape K_SPECIAL bytes in the character.
/// The sequence is not NUL terminated. /// The sequence is not NUL terminated.
/// This is how characters in a string are encoded. /// This is how characters in a string are encoded.
unsigned int special_to_buf(int key, int modifiers, bool escape_ks, char *dst) unsigned special_to_buf(int key, int modifiers, bool escape_ks, char *dst)
{ {
unsigned int dlen = 0; unsigned dlen = 0;
// Put the appropriate modifier in a string. // Put the appropriate modifier in a string.
if (modifiers != 0) { if (modifiers != 0) {
@ -608,9 +608,9 @@ unsigned int special_to_buf(int key, int modifiers, bool escape_ks, char *dst)
} else if (escape_ks) { } else if (escape_ks) {
char *after = add_char2buf(key, dst + dlen); char *after = add_char2buf(key, dst + dlen);
assert(after >= dst && (uintmax_t)(after - dst) <= UINT_MAX); assert(after >= dst && (uintmax_t)(after - dst) <= UINT_MAX);
dlen = (unsigned int)(after - dst); dlen = (unsigned)(after - dst);
} else { } else {
dlen += (unsigned int)utf_char2bytes(key, dst + dlen); dlen += (unsigned)utf_char2bytes(key, dst + dlen);
} }
return dlen; return dlen;

View File

@ -1094,7 +1094,7 @@ static int nlua_debug(lua_State *lstate)
.v_type = VAR_UNKNOWN, .v_type = VAR_UNKNOWN,
}, },
}; };
for (;;) { while (true) {
lua_settop(lstate, 0); lua_settop(lstate, 0);
typval_T input; typval_T input;
get_user_input(input_args, &input, false, false); get_user_input(input_args, &input, false, false);

View File

@ -69,10 +69,10 @@ int nlua_spell_check(lua_State *lstate)
lua_pushlstring(lstate, str, len); lua_pushlstring(lstate, str, len);
lua_rawseti(lstate, -2, 1); lua_rawseti(lstate, -2, 1);
result = attr == HLF_SPB ? "bad" : result = attr == HLF_SPB ? "bad" :
attr == HLF_SPR ? "rare" : attr == HLF_SPR ? "rare" :
attr == HLF_SPL ? "local" : attr == HLF_SPL ? "local" :
attr == HLF_SPC ? "caps" : attr == HLF_SPC ? "caps" :
NULL; NULL;
assert(result != NULL); assert(result != NULL);

View File

@ -455,7 +455,7 @@ static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
int ret = 0; int ret = 0;
assert(s1[s1_len] == NUL); assert(s1[s1_len] == NUL);
assert(s2[s2_len] == NUL); assert(s2[s2_len] == NUL);
do { while (true) {
nul1 = memchr(s1, NUL, s1_len); nul1 = memchr(s1, NUL, s1_len);
nul2 = memchr(s2, NUL, s2_len); nul2 = memchr(s2, NUL, s2_len);
ret = STRICMP(s1, s2); ret = STRICMP(s1, s2);
@ -479,7 +479,7 @@ static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
} else { } else {
break; break;
} }
} while (true); }
lua_pop(lstate, 2); lua_pop(lstate, 2);
lua_pushnumber(lstate, (lua_Number)((ret > 0) - (ret < 0))); lua_pushnumber(lstate, (lua_Number)((ret > 0) - (ret < 0)));
return 1; return 1;

View File

@ -454,7 +454,7 @@ static int parser_parse(lua_State *L)
// the lua GC. // the lua GC.
// Old tree is still owned by the lua GC. // Old tree is still owned by the lua GC.
uint32_t n_ranges = 0; uint32_t n_ranges = 0;
TSRange *changed = old_tree ? ts_tree_get_changed_ranges(old_tree, new_tree, &n_ranges) : NULL; TSRange *changed = old_tree ? ts_tree_get_changed_ranges(old_tree, new_tree, &n_ranges) : NULL;
push_tree(L, new_tree, false); // [tree] push_tree(L, new_tree, false); // [tree]

View File

@ -193,10 +193,10 @@ static bool check_xdiff_opt(ObjectType actType, ObjectType expType, const char *
{ {
if (actType != expType) { if (actType != expType) {
const char *type_str = const char *type_str =
expType == kObjectTypeString ? "string" : expType == kObjectTypeString ? "string" :
expType == kObjectTypeInteger ? "integer" : expType == kObjectTypeInteger ? "integer" :
expType == kObjectTypeBoolean ? "boolean" : expType == kObjectTypeBoolean ? "boolean" :
expType == kObjectTypeLuaRef ? "function" : expType == kObjectTypeLuaRef ? "function" :
"NA"; "NA";
api_set_error(err, kErrorTypeValidation, "%s is not a %s", name, api_set_error(err, kErrorTypeValidation, "%s is not a %s", name,

View File

@ -706,7 +706,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
hash_end = 256; hash_end = 256;
} }
for (int hash = hash_start; hash < hash_end && !got_int; hash++) { for (int hash = hash_start; hash < hash_end && !got_int; hash++) {
mpp = is_abbrev ? abbr_table : &(map_table[hash]); mpp = is_abbrev ? abbr_table : &(map_table[hash]);
for (mp = *mpp; mp != NULL && !got_int; mp = *mpp) { for (mp = *mpp; mp != NULL && !got_int; mp = *mpp) {
if ((mp->m_mode & mode) == 0) { if ((mp->m_mode & mode) == 0) {
// skip entries with wrong mode // skip entries with wrong mode
@ -1112,7 +1112,7 @@ int map_to_exists_mode(const char *const rhs, const int mode, const bool abbr)
bool exp_buffer = false; bool exp_buffer = false;
// Do it twice: once for global maps and once for local maps. // Do it twice: once for global maps and once for local maps.
for (;;) { while (true) {
for (hash = 0; hash < 256; hash++) { for (hash = 0; hash < 256; hash++) {
if (abbr) { if (abbr) {
if (hash > 0) { // There is only one abbr list. if (hash > 0) { // There is only one abbr list.
@ -1229,7 +1229,7 @@ char *set_context_in_map_cmd(expand_T *xp, char *cmd, char *arg, bool forceit, b
expand_isabbrev = isabbrev; expand_isabbrev = isabbrev;
xp->xp_context = EXPAND_MAPPINGS; xp->xp_context = EXPAND_MAPPINGS;
expand_buffer = false; expand_buffer = false;
for (;;) { while (true) {
if (strncmp(arg, "<buffer>", 8) == 0) { if (strncmp(arg, "<buffer>", 8) == 0) {
expand_buffer = true; expand_buffer = true;
arg = skipwhite(arg + 8); arg = skipwhite(arg + 8);
@ -2322,13 +2322,13 @@ static garray_T langmap_mapga = GA_EMPTY_INIT_VALUE;
static void langmap_set_entry(int from, int to) static void langmap_set_entry(int from, int to)
{ {
langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data); langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
unsigned int a = 0; unsigned a = 0;
assert(langmap_mapga.ga_len >= 0); assert(langmap_mapga.ga_len >= 0);
unsigned int b = (unsigned int)langmap_mapga.ga_len; unsigned b = (unsigned)langmap_mapga.ga_len;
// Do a binary search for an existing entry. // Do a binary search for an existing entry.
while (a != b) { while (a != b) {
unsigned int i = (a + b) / 2; unsigned i = (a + b) / 2;
int d = entries[i].from - from; int d = entries[i].from - from;
if (d == 0) { if (d == 0) {
@ -2347,7 +2347,7 @@ static void langmap_set_entry(int from, int to)
// insert new entry at position "a" // insert new entry at position "a"
entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a; entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
memmove(entries + 1, entries, memmove(entries + 1, entries,
((unsigned int)langmap_mapga.ga_len - a) * sizeof(langmap_entry_T)); ((unsigned)langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
langmap_mapga.ga_len++; langmap_mapga.ga_len++;
entries[0].from = from; entries[0].from = from;
entries[0].to = to; entries[0].to = to;

View File

@ -239,7 +239,7 @@ fmark_T *get_jumplist(win_T *win, int count)
return NULL; return NULL;
} }
for (;;) { while (true) {
if (win->w_jumplistidx + count < 0 if (win->w_jumplistidx + count < 0
|| win->w_jumplistidx + count >= win->w_jumplistlen) { || win->w_jumplistidx + count >= win->w_jumplistlen) {
return NULL; return NULL;

View File

@ -127,7 +127,7 @@ static inline int marktree_getp_aux(const mtnode_t *x, mtkey_t k, int *r)
if (x->n == 0) { if (x->n == 0) {
return -1; return -1;
} }
rr = r? r : &tr; rr = r ? r : &tr;
while (begin < end) { while (begin < end) {
int mid = (begin + end) >> 1; int mid = (begin + end) >> 1;
if (key_cmp(x->key[mid], k) < 0) { if (key_cmp(x->key[mid], k) < 0) {

View File

@ -77,7 +77,7 @@ typedef struct {
#define MARKTREE_END_FLAG (((uint64_t)1) << 63) #define MARKTREE_END_FLAG (((uint64_t)1) << 63)
static inline uint64_t mt_lookup_id(uint32_t ns, uint32_t id, bool enda) static inline uint64_t mt_lookup_id(uint32_t ns, uint32_t id, bool enda)
{ {
return (uint64_t)ns << 32 | id | (enda?MARKTREE_END_FLAG:0); return (uint64_t)ns << 32 | id | (enda ? MARKTREE_END_FLAG : 0);
} }
#undef MARKTREE_END_FLAG #undef MARKTREE_END_FLAG

View File

@ -111,7 +111,7 @@ static int match_add(win_T *wp, const char *const grp, const char *const pat, in
} }
m->mit_id = id; m->mit_id = id;
m->mit_priority = prio; m->mit_priority = prio;
m->mit_pattern = pat == NULL ? NULL: xstrdup(pat); m->mit_pattern = pat == NULL ? NULL : xstrdup(pat);
m->mit_hlg_id = hlg_id; m->mit_hlg_id = hlg_id;
m->mit_match.regprog = regprog; m->mit_match.regprog = regprog;
m->mit_match.rmm_ic = false; m->mit_match.rmm_ic = false;
@ -388,7 +388,7 @@ static int next_search_hl_pos(match_T *shl, linenr_T lnum, matchitem_T *match, c
match->mit_pos_cur = 0; match->mit_pos_cur = 0;
if (found >= 0) { if (found >= 0) {
colnr_T start = match->mit_pos_array[found].col == 0 colnr_T start = match->mit_pos_array[found].col == 0
? 0: match->mit_pos_array[found].col - 1; ? 0 : match->mit_pos_array[found].col - 1;
colnr_T end = match->mit_pos_array[found].col == 0 colnr_T end = match->mit_pos_array[found].col == 0
? MAXCOL : start + match->mit_pos_array[found].len; ? MAXCOL : start + match->mit_pos_array[found].len;
@ -444,7 +444,7 @@ static void next_search_hl(win_T *win, match_T *search_hl, match_T *shl, linenr_
// Repeat searching for a match until one is found that includes "mincol" // Repeat searching for a match until one is found that includes "mincol"
// or none is found in this line. // or none is found in this line.
for (;;) { while (true) {
// Stop searching after passing the time limit. // Stop searching after passing the time limit.
if (profile_passed_limit(shl->tm)) { if (profile_passed_limit(shl->tm)) {
shl->lnum = 0; // no match found in time shl->lnum = 0; // no match found in time

View File

@ -749,7 +749,7 @@ int utfc_ptr2char(const char *p, int *pcc)
&& (uint8_t)p[len] >= 0x80 && (uint8_t)p[len] >= 0x80
&& utf_composinglike(p, p + len)) { && utf_composinglike(p, p + len)) {
int cc = utf_ptr2char(p + len); int cc = utf_ptr2char(p + len);
for (;;) { while (true) {
pcc[i++] = cc; pcc[i++] = cc;
if (i == MAX_MCO) { if (i == MAX_MCO) {
break; break;
@ -889,7 +889,7 @@ int utfc_ptr2len(const char *const p)
// Check for composing characters. We can handle only the first six, but // Check for composing characters. We can handle only the first six, but
// skip all of them (otherwise the cursor would get stuck). // skip all of them (otherwise the cursor would get stuck).
int prevlen = 0; int prevlen = 0;
for (;;) { while (true) {
if ((uint8_t)p[len] < 0x80 || !utf_composinglike(p + prevlen, p + len)) { if ((uint8_t)p[len] < 0x80 || !utf_composinglike(p + prevlen, p + len)) {
return len; return len;
} }
@ -1051,9 +1051,9 @@ int utf_class_tab(const int c, const uint64_t *const chartab)
{ {
// sorted list of non-overlapping intervals // sorted list of non-overlapping intervals
static struct clinterval { static struct clinterval {
unsigned int first; unsigned first;
unsigned int last; unsigned last;
unsigned int cls; unsigned cls;
} classes[] = { } classes[] = {
{ 0x037e, 0x037e, 1 }, // Greek question mark { 0x037e, 0x037e, 1 }, // Greek question mark
{ 0x0387, 0x0387, 1 }, // Greek ano teleia { 0x0387, 0x0387, 1 }, // Greek ano teleia
@ -1149,9 +1149,9 @@ int utf_class_tab(const int c, const uint64_t *const chartab)
// binary search in table // binary search in table
while (top >= bot) { while (top >= bot) {
int mid = (bot + top) / 2; int mid = (bot + top) / 2;
if (classes[mid].last < (unsigned int)c) { if (classes[mid].last < (unsigned)c) {
bot = mid + 1; bot = mid + 1;
} else if (classes[mid].first > (unsigned int)c) { } else if (classes[mid].first > (unsigned)c) {
top = mid - 1; top = mid - 1;
} else { } else {
return (int)classes[mid].cls; return (int)classes[mid].cls;
@ -1276,7 +1276,7 @@ static int utf_strnicmp(const char *s1, const char *s2, size_t n1, size_t n2)
int c1, c2, cdiff; int c1, c2, cdiff;
char buffer[6]; char buffer[6];
for (;;) { while (true) {
c1 = utf_safe_read_char_adv(&s1, &n1); c1 = utf_safe_read_char_adv(&s1, &n1);
c2 = utf_safe_read_char_adv(&s2, &n2); c2 = utf_safe_read_char_adv(&s2, &n2);
@ -1881,7 +1881,7 @@ void utf_find_illegal(void)
} }
curwin->w_cursor.coladd = 0; curwin->w_cursor.coladd = 0;
for (;;) { while (true) {
p = get_cursor_pos_ptr(); p = get_cursor_pos_ptr();
if (vimconv.vc_type != CONV_NONE) { if (vimconv.vc_type != CONV_NONE) {
xfree(tofree); xfree(tofree);
@ -2299,7 +2299,7 @@ static char *iconv_string(const vimconv_T *const vcp, const char *str, size_t sl
from = str; from = str;
fromlen = slen; fromlen = slen;
for (;;) { while (true) {
if (len == 0 || ICONV_ERRNO == ICONV_E2BIG) { if (len == 0 || ICONV_ERRNO == ICONV_E2BIG) {
// Allocate enough room for most conversions. When re-allocating // Allocate enough room for most conversions. When re-allocating
// increase the buffer size. // increase the buffer size.

View File

@ -628,7 +628,7 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp)
/// to extend the file. /// to extend the file.
/// If block 'mf_infile_count' is not in the hash list, it has been /// If block 'mf_infile_count' is not in the hash list, it has been
/// freed. Fill the space in the file with data from the current block. /// freed. Fill the space in the file with data from the current block.
for (;;) { while (true) {
blocknr_T nr = hp->bh_bnum; // block nr which is being written blocknr_T nr = hp->bh_bnum; // block nr which is being written
if (nr > mfp->mf_infile_count) { // beyond end of file if (nr > mfp->mf_infile_count) { // beyond end of file
nr = mfp->mf_infile_count; nr = mfp->mf_infile_count;

View File

@ -392,7 +392,7 @@ void ml_setname(buf_T *buf)
// Try all directories in the 'directory' option. // Try all directories in the 'directory' option.
char *dirp = p_dir; char *dirp = p_dir;
bool found_existing_dir = false; bool found_existing_dir = false;
for (;;) { while (true) {
if (*dirp == NUL) { // tried all directories, fail if (*dirp == NUL) { // tried all directories, fail
break; break;
} }
@ -479,7 +479,7 @@ void ml_open_file(buf_T *buf)
// Try all directories in 'directory' option. // Try all directories in 'directory' option.
char *dirp = p_dir; char *dirp = p_dir;
bool found_existing_dir = false; bool found_existing_dir = false;
for (;;) { while (true) {
if (*dirp == NUL) { if (*dirp == NUL) {
break; break;
} }
@ -2262,7 +2262,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
// allocate a new pointer block // allocate a new pointer block
// move some of the pointer into the new block // move some of the pointer into the new block
// prepare for updating the parent block // prepare for updating the parent block
for (;;) { // do this twice when splitting block 1 while (true) { // do this twice when splitting block 1
hp_new = ml_new_ptr(mfp); hp_new = ml_new_ptr(mfp);
if (hp_new == NULL) { // TODO(vim): try to fix tree if (hp_new == NULL) { // TODO(vim): try to fix tree
return FAIL; return FAIL;
@ -2857,7 +2857,7 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
buf->b_ml.ml_stack_top = 0; // start at the root buf->b_ml.ml_stack_top = 0; // start at the root
} }
// search downwards in the tree until a data block is found // search downwards in the tree until a data block is found
for (;;) { while (true) {
if ((hp = mf_get(mfp, bnum, (unsigned)page_count)) == NULL) { if ((hp = mf_get(mfp, bnum, (unsigned)page_count)) == NULL) {
goto error_noblock; goto error_noblock;
} }
@ -3021,7 +3021,7 @@ int resolve_symlink(const char *fname, char *buf)
// Put the result so far in tmp[], starting with the original name. // Put the result so far in tmp[], starting with the original name.
xstrlcpy(tmp, fname, MAXPATHL); xstrlcpy(tmp, fname, MAXPATHL);
for (;;) { while (true) {
// Limit symlink depth to 100, catch recursive loops. // Limit symlink depth to 100, catch recursive loops.
if (++depth == 100) { if (++depth == 100) {
semsg(_("E773: Symlink loop for \"%s\""), fname); semsg(_("E773: Symlink loop for \"%s\""), fname);
@ -3273,7 +3273,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// we try different names until we find one that does not exist yet // we try different names until we find one that does not exist yet
char *fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name); char *fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);
for (;;) { while (true) {
size_t n; size_t n;
if (fname == NULL) { // must be out of memory if (fname == NULL) { // must be out of memory
break; break;

View File

@ -782,7 +782,7 @@ void free_all_mem(void)
first_tabpage = NULL; first_tabpage = NULL;
// message history // message history
for (;;) { while (true) {
if (delete_first_msg() == FAIL) { if (delete_first_msg() == FAIL) {
break; break;
} }

View File

@ -88,7 +88,7 @@ void ex_menu(exarg_T *eap)
modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu);
arg = eap->arg; arg = eap->arg;
for (;;) { while (true) {
if (strncmp(arg, "<script>", 8) == 0) { if (strncmp(arg, "<script>", 8) == 0) {
noremap = REMAP_SCRIPT; noremap = REMAP_SCRIPT;
arg = skipwhite(arg + 8); arg = skipwhite(arg + 8);

View File

@ -438,7 +438,7 @@ void trunc_string(const char *s, char *buf, int room_in, int buflen)
// Last part: End of the string. // Last part: End of the string.
half = i = (int)strlen(s); half = i = (int)strlen(s);
for (;;) { while (true) {
do { do {
half = half - utf_head_off(s, s + half - 1) - 1; half = half - utf_head_off(s, s + half - 1) - 1;
} while (half > 0 && utf_iscomposing(utf_ptr2char(s + half))); } while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
@ -2656,7 +2656,7 @@ static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
{ {
msgchunk_T *mp = smp; msgchunk_T *mp = smp;
for (;;) { while (true) {
msg_row = row; msg_row = row;
msg_col = mp->sb_msg_col; msg_col = mp->sb_msg_col;
char *p = mp->sb_text; char *p = mp->sb_text;
@ -2801,7 +2801,7 @@ static int do_more_prompt(int typed_char)
if (typed_char == NUL) { if (typed_char == NUL) {
msg_moremsg(false); msg_moremsg(false);
} }
for (;;) { while (true) {
// Get a typed character directly from the user. // Get a typed character directly from the user.
if (used_typed_char != NUL) { if (used_typed_char != NUL) {
c = used_typed_char; // was typed at hit-enter prompt c = used_typed_char; // was typed at hit-enter prompt
@ -3528,7 +3528,7 @@ int do_dialog(int type, char *title, char *message, char *buttons, int dfltbutto
no_wait_return++; no_wait_return++;
hotkeys = msg_show_console_dialog(message, buttons, dfltbutton); hotkeys = msg_show_console_dialog(message, buttons, dfltbutton);
for (;;) { while (true) {
// Get a typed character directly from the user. // Get a typed character directly from the user.
int c = get_keystroke(NULL); int c = get_keystroke(NULL);
switch (c) { switch (c) {

View File

@ -310,7 +310,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
pos_T save_cursor = curwin->w_cursor; pos_T save_cursor = curwin->w_cursor;
for (;;) { while (true) {
which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag); which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag);
if (is_drag) { if (is_drag) {
// If the next character is the same mouse event then use that // If the next character is the same mouse event then use that
@ -1474,7 +1474,7 @@ win_T *mouse_find_win(int *gridp, int *rowp, int *colp)
frame_T *fp = topframe; frame_T *fp = topframe;
*rowp -= firstwin->w_winrow; *rowp -= firstwin->w_winrow;
for (;;) { while (true) {
if (fp->fr_layout == FR_LEAF) { if (fp->fr_layout == FR_LEAF) {
break; break;
} }
@ -1580,7 +1580,7 @@ static colnr_T scroll_line_len(linenr_T lnum)
colnr_T col = 0; colnr_T col = 0;
char *line = ml_get(lnum); char *line = ml_get(lnum);
if (*line != NUL) { if (*line != NUL) {
for (;;) { while (true) {
int numchar = win_chartabsize(curwin, line, col); int numchar = win_chartabsize(curwin, line, col);
MB_PTR_ADV(line); MB_PTR_ADV(line);
if (*line == NUL) { // don't count the last character if (*line == NUL) { // don't count the last character

View File

@ -780,7 +780,7 @@ void curs_columns(win_T *wp, int may_scroll)
int off_right = int off_right =
endcol - wp->w_leftcol - wp->w_width_inner + (int)siso + 1; endcol - wp->w_leftcol - wp->w_width_inner + (int)siso + 1;
if (off_left < 0 || off_right > 0) { if (off_left < 0 || off_right > 0) {
int diff = (off_left < 0) ? -off_left: off_right; int diff = (off_left < 0) ? -off_left : off_right;
// When far off or not enough room on either side, put cursor in // When far off or not enough room on either side, put cursor in
// middle of window. // middle of window.

View File

@ -2342,7 +2342,7 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar
// Search forward for the identifier, ignore comment lines. // Search forward for the identifier, ignore comment lines.
clearpos(&found_pos); clearpos(&found_pos);
for (;;) { while (true) {
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD, t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
pat, 1L, searchflags, RE_LAST, NULL); pat, 1L, searchflags, RE_LAST, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum) { if (curwin->w_cursor.lnum >= old_pos.lnum) {
@ -2692,7 +2692,7 @@ static bool nv_z_get_count(cmdarg_T *cap, int *nchar_arg)
} }
long n = nchar - '0'; long n = nchar - '0';
for (;;) { while (true) {
no_mapping++; no_mapping++;
allow_keys++; // no mapping for nchar, but allow key codes allow_keys++; // no mapping for nchar, but allow key codes
nchar = plain_vgetc(); nchar = plain_vgetc();
@ -4162,7 +4162,7 @@ static void nv_bracket_block(cmdarg_T *cap, const pos_T *old_pos)
pos = NULL; pos = NULL;
} }
while (n > 0) { while (n > 0) {
for (;;) { while (true) {
if ((findc == '{' ? dec_cursor() : inc_cursor()) < 0) { if ((findc == '{' ? dec_cursor() : inc_cursor()) < 0) {
// if not found anything, that's an error // if not found anything, that's an error
if (pos == NULL) { if (pos == NULL) {
@ -4310,7 +4310,7 @@ static void nv_brackets(cmdarg_T *cap)
fm = prev_fm; fm = prev_fm;
} }
MarkMove flags = kMarkContext; MarkMove flags = kMarkContext;
flags |= cap->nchar == '\'' ? kMarkBeginLine: 0; flags |= cap->nchar == '\'' ? kMarkBeginLine : 0;
nv_mark_move_to(cap, flags, fm); nv_mark_move_to(cap, flags, fm);
} else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE) { } else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE) {
// [ or ] followed by a middle mouse click: put selected text with // [ or ] followed by a middle mouse click: put selected text with

View File

@ -2090,7 +2090,7 @@ void op_tilde(oparg_T *oap)
did_change = swapchars(oap->op_type, &pos, did_change = swapchars(oap->op_type, &pos,
oap->end.col - pos.col + 1); oap->end.col - pos.col + 1);
} else { } else {
for (;;) { while (true) {
did_change |= swapchars(oap->op_type, &pos, did_change |= swapchars(oap->op_type, &pos,
pos.lnum == oap->end.lnum ? oap->end.col + 1 : pos.lnum == oap->end.lnum ? oap->end.col + 1 :
(int)strlen(ml_get_pos(&pos))); (int)strlen(ml_get_pos(&pos)));
@ -2944,7 +2944,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
long cnt; long cnt;
const pos_T orig_start = curbuf->b_op_start; const pos_T orig_start = curbuf->b_op_start;
const pos_T orig_end = curbuf->b_op_end; const pos_T orig_end = curbuf->b_op_end;
unsigned int cur_ve_flags = get_ve_flags(); unsigned cur_ve_flags = get_ve_flags();
if (flags & PUT_FIXINDENT) { if (flags & PUT_FIXINDENT) {
orig_indent = get_indent(); orig_indent = get_indent();
@ -3056,7 +3056,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
// For the = register we need to split the string at NL // For the = register we need to split the string at NL
// characters. // characters.
// Loop twice: count the number of lines and save them. // Loop twice: count the number of lines and save them.
for (;;) { while (true) {
y_size = 0; y_size = 0;
ptr = insert_string; ptr = insert_string;
while (ptr != NULL) { while (ptr != NULL) {
@ -3717,7 +3717,7 @@ end:
/// there move it left. /// there move it left.
void adjust_cursor_eol(void) void adjust_cursor_eol(void)
{ {
unsigned int cur_ve_flags = get_ve_flags(); unsigned cur_ve_flags = get_ve_flags();
const bool adj_cursor = (curwin->w_cursor.col > 0 const bool adj_cursor = (curwin->w_cursor.col > 0
&& gchar_cursor() == NUL && gchar_cursor() == NUL
@ -6470,7 +6470,7 @@ static yankreg_T *adjust_clipboard_name(int *name, bool quiet, bool writing)
} }
if (cb_flags & CB_UNNAMEDPLUS) { if (cb_flags & CB_UNNAMEDPLUS) {
*name = (cb_flags & CB_UNNAMED && writing) ? '"': '+'; *name = (cb_flags & CB_UNNAMED && writing) ? '"' : '+';
target = &y_regs[PLUS_REGISTER]; target = &y_regs[PLUS_REGISTER];
} else { } else {
*name = '*'; *name = '*';

View File

@ -5753,7 +5753,7 @@ bool can_bs(int what)
/// Get the local or global value of 'backupcopy'. /// Get the local or global value of 'backupcopy'.
/// ///
/// @param buf The buffer. /// @param buf The buffer.
unsigned int get_bkc_value(buf_T *buf) unsigned get_bkc_value(buf_T *buf)
{ {
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
} }
@ -5770,7 +5770,7 @@ char *get_flp_value(buf_T *buf)
} }
/// Get the local or global value of the 'virtualedit' flags. /// Get the local or global value of the 'virtualedit' flags.
unsigned int get_ve_flags(void) unsigned get_ve_flags(void)
{ {
return (curwin->w_ve_flags ? curwin->w_ve_flags : ve_flags) & ~(VE_NONE | VE_NONEU); return (curwin->w_ve_flags ? curwin->w_ve_flags : ve_flags) & ~(VE_NONE | VE_NONEU);
} }

View File

@ -410,7 +410,7 @@ EXTERN char *p_bs; // 'backspace'
EXTERN char *p_bg; // 'background' EXTERN char *p_bg; // 'background'
EXTERN int p_bk; // 'backup' EXTERN int p_bk; // 'backup'
EXTERN char *p_bkc; // 'backupcopy' EXTERN char *p_bkc; // 'backupcopy'
EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy' EXTERN unsigned bkc_flags; ///< flags from 'backupcopy'
#define BKC_YES 0x001 #define BKC_YES 0x001
#define BKC_AUTO 0x002 #define BKC_AUTO 0x002
#define BKC_NO 0x004 #define BKC_NO 0x004
@ -707,7 +707,7 @@ EXTERN long p_smc; ///< 'synmaxcol'
EXTERN long p_tpm; // 'tabpagemax' EXTERN long p_tpm; // 'tabpagemax'
EXTERN char *p_tal; // 'tabline' EXTERN char *p_tal; // 'tabline'
EXTERN char *p_tpf; // 'termpastefilter' EXTERN char *p_tpf; // 'termpastefilter'
EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter' EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter'
#define TPF_BS 0x001 #define TPF_BS 0x001
#define TPF_HT 0x002 #define TPF_HT 0x002
#define TPF_FF 0x004 #define TPF_FF 0x004
@ -721,7 +721,7 @@ EXTERN char *p_spf; ///< 'spellfile'
EXTERN char *p_spk; ///< 'splitkeep' EXTERN char *p_spk; ///< 'splitkeep'
EXTERN char *p_spl; ///< 'spelllang' EXTERN char *p_spl; ///< 'spelllang'
EXTERN char *p_spo; // 'spelloptions' EXTERN char *p_spo; // 'spelloptions'
EXTERN unsigned int spo_flags; EXTERN unsigned spo_flags;
EXTERN char *p_sps; // 'spellsuggest' EXTERN char *p_sps; // 'spellsuggest'
EXTERN int p_spr; // 'splitright' EXTERN int p_spr; // 'splitright'
EXTERN int p_sol; // 'startofline' EXTERN int p_sol; // 'startofline'

View File

@ -484,7 +484,7 @@ static const char *check_mousescroll(char *string)
long vertical = -1; long vertical = -1;
long horizontal = -1; long horizontal = -1;
for (;;) { while (true) {
char *end = vim_strchr(string, ','); char *end = vim_strchr(string, ',');
size_t length = end ? (size_t)(end - string) : strlen(string); size_t length = end ? (size_t)(end - string) : strlen(string);
@ -654,7 +654,7 @@ static bool check_illegal_path_names(char *val, uint32_t flags)
static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, const char **errmsg) static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, const char **errmsg)
{ {
char *bkc = p_bkc; char *bkc = p_bkc;
unsigned int *flags = &bkc_flags; unsigned *flags = &bkc_flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
bkc = buf->b_p_bkc; bkc = buf->b_p_bkc;
@ -1322,7 +1322,7 @@ static void did_set_backspace(const char **errmsg)
static void did_set_tagcase(buf_T *buf, int opt_flags, const char **errmsg) static void did_set_tagcase(buf_T *buf, int opt_flags, const char **errmsg)
{ {
unsigned int *flags; unsigned *flags;
char *p; char *p;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
@ -1391,7 +1391,7 @@ static void did_set_foldignore(win_T *win)
static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, const char **errmsg) static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, const char **errmsg)
{ {
char *ve = p_ve; char *ve = p_ve;
unsigned int *flags = &ve_flags; unsigned *flags = &ve_flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
ve = win->w_p_ve; ve = win->w_p_ve;
@ -1912,10 +1912,10 @@ static int check_opt_strings(char *val, char **values, int list)
/// @return OK for correct value, FAIL otherwise. Empty is always OK. /// @return OK for correct value, FAIL otherwise. Empty is always OK.
static int opt_strings_flags(char *val, char **values, unsigned *flagp, bool list) static int opt_strings_flags(char *val, char **values, unsigned *flagp, bool list)
{ {
unsigned int new_flags = 0; unsigned new_flags = 0;
while (*val) { while (*val) {
for (unsigned int i = 0;; i++) { for (unsigned i = 0;; i++) {
if (values[i] == NULL) { // val not found in values[] if (values[i] == NULL) { // val not found in values[]
return FAIL; return FAIL;
} }

View File

@ -1084,7 +1084,7 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si
// er's home directory)). // er's home directory)).
char *p = homedir; char *p = homedir;
size_t len = dirlen; size_t len = dirlen;
for (;;) { while (true) {
if (len if (len
&& path_fnamencmp(src, p, len) == 0 && path_fnamencmp(src, p, len) == 0
&& (vim_ispathsep(src[len]) && (vim_ispathsep(src[len])

View File

@ -339,7 +339,7 @@ static bool is_executable_in_path(const char *name, char **abspath)
// is an executable file. // is an executable file.
char *p = path; char *p = path;
bool rv = false; bool rv = false;
for (;;) { while (true) {
char *e = xstrchrnul(p, ENV_SEPCHAR); char *e = xstrchrnul(p, ENV_SEPCHAR);
// Combine the $PATH segment with `name`. // Combine the $PATH segment with `name`.

View File

@ -253,7 +253,7 @@ size_t input_enqueue(String keys)
// K_SPECIAL(0x80). // K_SPECIAL(0x80).
uint8_t buf[19] = { 0 }; uint8_t buf[19] = { 0 };
// Do not simplify the keys here. Simplification will be done later. // Do not simplify the keys here. Simplification will be done later.
unsigned int new_size unsigned new_size
= trans_special((const char **)&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true, = trans_special((const char **)&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true,
NULL); NULL);
@ -346,7 +346,7 @@ static uint8_t check_multiclick(int code, int grid, int row, int col)
// Mouse event handling code(Extract row/col if available and detect multiple // Mouse event handling code(Extract row/col if available and detect multiple
// clicks) // clicks)
static unsigned int handle_mouse_event(char **ptr, uint8_t *buf, unsigned int bufsize) static unsigned handle_mouse_event(char **ptr, uint8_t *buf, unsigned bufsize)
{ {
int mouse_code = 0; int mouse_code = 0;
int type = 0; int type = 0;

View File

@ -72,7 +72,7 @@ static bool os_proc_tree_kill_rec(HANDLE process, int sig)
} }
theend: theend:
return (bool)TerminateProcess(process, (unsigned int)sig); return (bool)TerminateProcess(process, (unsigned)sig);
} }
/// Kills process `pid` and its descendants recursively. /// Kills process `pid` and its descendants recursively.
bool os_proc_tree_kill(int pid, int sig) bool os_proc_tree_kill(int pid, int sig)

View File

@ -1225,7 +1225,7 @@ static void read_input(DynamicBuffer *buf)
linenr_T lnum = curbuf->b_op_start.lnum; linenr_T lnum = curbuf->b_op_start.lnum;
char *lp = ml_get(lnum); char *lp = ml_get(lnum);
for (;;) { while (true) {
l = strlen(lp + written); l = strlen(lp + written);
if (l == 0) { if (l == 0) {
len = 0; len = 0;

View File

@ -100,7 +100,7 @@ int plines_win_nofill(win_T *wp, linenr_T lnum, bool winheight)
int plines_win_nofold(win_T *wp, linenr_T lnum) int plines_win_nofold(win_T *wp, linenr_T lnum)
{ {
char *s; char *s;
unsigned int col; unsigned col;
int width; int width;
s = ml_get_buf(wp->w_buffer, lnum, false); s = ml_get_buf(wp->w_buffer, lnum, false);
@ -120,10 +120,10 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
if (width <= 0 || col > 32000) { if (width <= 0 || col > 32000) {
return 32000; // bigger than the number of screen columns return 32000; // bigger than the number of screen columns
} }
if (col <= (unsigned int)width) { if (col <= (unsigned)width) {
return 1; return 1;
} }
col -= (unsigned int)width; col -= (unsigned)width;
width += win_col_off2(wp); width += win_col_off2(wp);
assert(col <= INT_MAX && (int)col < INT_MAX - (width - 1)); assert(col <= INT_MAX && (int)col < INT_MAX - (width - 1));
return ((int)col + (width - 1)) / width + 1; return ((int)col + (width - 1)) / width + 1;
@ -272,7 +272,7 @@ int linetabsize_col(int startcol, char *s)
/// @param len /// @param len
/// ///
/// @return Number of characters the string will take on the screen. /// @return Number of characters the string will take on the screen.
unsigned int win_linetabsize(win_T *wp, linenr_T lnum, char *line, colnr_T len) unsigned win_linetabsize(win_T *wp, linenr_T lnum, char *line, colnr_T len)
{ {
chartabsize_T cts; chartabsize_T cts;
init_chartabsize_arg(&cts, wp, lnum, 0, line, line); init_chartabsize_arg(&cts, wp, lnum, 0, line, line);
@ -281,7 +281,7 @@ unsigned int win_linetabsize(win_T *wp, linenr_T lnum, char *line, colnr_T len)
cts.cts_vcol += win_lbr_chartabsize(&cts, NULL); cts.cts_vcol += win_lbr_chartabsize(&cts, NULL);
} }
clear_chartabsize_arg(&cts); clear_chartabsize_arg(&cts);
return (unsigned int)cts.cts_vcol; return (unsigned)cts.cts_vcol;
} }
/// Prepare the structure passed to chartabsize functions. /// Prepare the structure passed to chartabsize functions.
@ -405,7 +405,7 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
} }
} }
for (;;) { while (true) {
char *ps = s; char *ps = s;
MB_PTR_ADV(s); MB_PTR_ADV(s);
c = (uint8_t)(*s); c = (uint8_t)(*s);

View File

@ -1083,7 +1083,7 @@ void pum_show_popupmenu(vimmenu_T *menu)
ui_call_option_set(STATIC_CSTR_AS_STRING("mousemoveevent"), BOOLEAN_OBJ(true)); ui_call_option_set(STATIC_CSTR_AS_STRING("mousemoveevent"), BOOLEAN_OBJ(true));
} }
for (;;) { while (true) {
pum_is_visible = true; pum_is_visible = true;
pum_is_drawn = true; pum_is_drawn = true;
pum_grid.zindex = kZIndexCmdlinePopupMenu; // show above cmdline area #23275 pum_grid.zindex = kZIndexCmdlinePopupMenu; // show above cmdline area #23275

View File

@ -800,7 +800,7 @@ retry:
memcpy(state->growbuf, IObuff, IOSIZE - 1); memcpy(state->growbuf, IObuff, IOSIZE - 1);
size_t growbuflen = state->linelen; size_t growbuflen = state->linelen;
for (;;) { while (true) {
errno = 0; errno = 0;
if (fgets(state->growbuf + growbuflen, if (fgets(state->growbuf + growbuflen,
(int)(state->growbufsiz - growbuflen), state->fd) == NULL) { (int)(state->growbufsiz - growbuflen), state->fd) == NULL) {
@ -2291,7 +2291,7 @@ static char *qf_guess_filepath(qf_list_T *qfl, char *filename)
} }
/// Returns true, if a quickfix/location list with the given identifier exists. /// Returns true, if a quickfix/location list with the given identifier exists.
static bool qflist_valid(win_T *wp, unsigned int qf_id) static bool qflist_valid(win_T *wp, unsigned qf_id)
{ {
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
@ -2641,7 +2641,7 @@ static void qf_goto_win_with_qfl_file(int qf_fnum)
{ {
win_T *win = curwin; win_T *win = curwin;
win_T *altwin = NULL; win_T *altwin = NULL;
for (;;) { while (true) {
if (win->w_buffer->b_fnum == qf_fnum) { if (win->w_buffer->b_fnum == qf_fnum) {
break; break;
} }
@ -4414,7 +4414,7 @@ static char *get_mef_name(void)
} }
// Keep trying until the name doesn't exist yet. // Keep trying until the name doesn't exist yet.
for (;;) { while (true) {
if (start == -1) { if (start == -1) {
start = (int)os_get_pid(); start = (int)os_get_pid();
} else { } else {

View File

@ -1159,7 +1159,7 @@ static bool reg_match_visual(void)
rex.line = (uint8_t *)reg_getline(rex.lnum); rex.line = (uint8_t *)reg_getline(rex.lnum);
rex.input = rex.line + col; rex.input = rex.line + col;
unsigned int cols_u = win_linetabsize(wp, rex.reg_firstlnum + rex.lnum, (char *)rex.line, col); unsigned cols_u = win_linetabsize(wp, rex.reg_firstlnum + rex.lnum, (char *)rex.line, col);
assert(cols_u <= MAXCOL); assert(cols_u <= MAXCOL);
colnr_T cols = (colnr_T)cols_u; colnr_T cols = (colnr_T)cols_u;
if (cols < start || cols > end - (*p_sel == 'e')) { if (cols < start || cols > end - (*p_sel == 'e')) {
@ -1248,7 +1248,7 @@ static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T e
if (bytelen != NULL) { if (bytelen != NULL) {
*bytelen = 0; *bytelen = 0;
} }
for (;;) { while (true) {
// Since getting one line may invalidate the other, need to make copy. // Since getting one line may invalidate the other, need to make copy.
// Slow! // Slow!
if (rex.line != reg_tofree) { if (rex.line != reg_tofree) {
@ -2003,7 +2003,7 @@ static int vim_regsub_both(char *source, typval_T *expr, char *dest, int destlen
} }
} }
if (s != NULL) { if (s != NULL) {
for (;;) { while (true) {
if (len == 0) { if (len == 0) {
if (REG_MULTI) { if (REG_MULTI) {
if (rex.reg_mmatch->endpos[no].lnum == clnum) { if (rex.reg_mmatch->endpos[no].lnum == clnum) {

View File

@ -1513,7 +1513,7 @@ static void regtail(uint8_t *p, uint8_t *val)
// Find last node. // Find last node.
uint8_t *scan = p; uint8_t *scan = p;
for (;;) { while (true) {
uint8_t *temp = regnext(scan); uint8_t *temp = regnext(scan);
if (temp == NULL) { if (temp == NULL) {
break; break;
@ -2427,7 +2427,7 @@ do_multibyte:
int l; int l;
// Need to get composing character too. // Need to get composing character too.
for (;;) { while (true) {
l = utf_ptr2len((char *)regparse); l = utf_ptr2len((char *)regparse);
if (!utf_composinglike(regparse, regparse + l)) { if (!utf_composinglike(regparse, regparse + l)) {
break; break;
@ -2683,7 +2683,7 @@ static uint8_t *regbranch(int *flagp)
*flagp = WORST | HASNL; // Tentatively. *flagp = WORST | HASNL; // Tentatively.
ret = regnode(BRANCH); ret = regnode(BRANCH);
for (;;) { while (true) {
latest = regconcat(&flags); latest = regconcat(&flags);
if (latest == NULL) { if (latest == NULL) {
return NULL; return NULL;
@ -3536,7 +3536,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
backpos.ga_len = 0; backpos.ga_len = 0;
// Repeat until "regstack" is empty. // Repeat until "regstack" is empty.
for (;;) { while (true) {
// Some patterns may take a long time to match, e.g., "\([a-z]\+\)\+Q". // Some patterns may take a long time to match, e.g., "\([a-z]\+\)\+Q".
// Allow interrupting them with CTRL-C. // Allow interrupting them with CTRL-C.
reg_breakcheck(); reg_breakcheck();
@ -3550,7 +3550,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
// Repeat for items that can be matched sequentially, without using the // Repeat for items that can be matched sequentially, without using the
// regstack. // regstack.
for (;;) { while (true) {
if (got_int || scan == NULL) { if (got_int || scan == NULL) {
status = RA_FAIL; status = RA_FAIL;
break; break;
@ -4770,7 +4770,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
} }
// Repeat until we found a position where it could match. // Repeat until we found a position where it could match.
for (;;) { while (true) {
if (status != RA_BREAK) { if (status != RA_BREAK) {
// Tried first position already, advance. // Tried first position already, advance.
if (rp->rs_state == RS_STAR_LONG) { if (rp->rs_state == RS_STAR_LONG) {

View File

@ -2505,7 +2505,7 @@ nfa_do_multibyte:
// building the postfix form, not the NFA itself; // building the postfix form, not the NFA itself;
// a composing char could be: a, b, c, NFA_COMPOSING // a composing char could be: a, b, c, NFA_COMPOSING
// where 'b' and 'c' are chars with codes > 256. */ // where 'b' and 'c' are chars with codes > 256. */
for (;;) { while (true) {
EMIT(c); EMIT(c);
if (i > 0) { if (i > 0) {
EMIT(NFA_CONCAT); EMIT(NFA_CONCAT);
@ -5799,7 +5799,7 @@ static long find_match_text(colnr_T *startcol, int regstart, uint8_t *match_text
colnr_T col = *startcol; colnr_T col = *startcol;
int regstart_len = PTR2LEN((char *)rex.line + col); int regstart_len = PTR2LEN((char *)rex.line + col);
for (;;) { while (true) {
bool match = true; bool match = true;
uint8_t *s1 = match_text; uint8_t *s1 = match_text;
uint8_t *s2 = rex.line + col + regstart_len; // skip regstart uint8_t *s2 = rex.line + col + regstart_len; // skip regstart
@ -5966,7 +5966,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
} }
// Run for each character. // Run for each character.
for (;;) { while (true) {
int curc = utf_ptr2char((char *)rex.input); int curc = utf_ptr2char((char *)rex.input);
int clen = utfc_ptr2len((char *)rex.input); int clen = utfc_ptr2len((char *)rex.input);
if (curc == NUL) { if (curc == NUL) {
@ -6501,7 +6501,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
state = t->state->out; state = t->state->out;
result_if_matched = (t->state->c == NFA_START_COLL); result_if_matched = (t->state->c == NFA_START_COLL);
for (;;) { while (true) {
if (state->c == NFA_END_COLL) { if (state->c == NFA_END_COLL) {
result = !result_if_matched; result = !result_if_matched;
break; break;

View File

@ -2558,7 +2558,7 @@ static char *get_one_sourceline(struct source_cookie *sp)
// Loop until there is a finished line (or end-of-file). // Loop until there is a finished line (or end-of-file).
sp->sourcing_lnum++; sp->sourcing_lnum++;
for (;;) { while (true) {
// make room to read at least 120 (more) characters // make room to read at least 120 (more) characters
ga_grow(&ga, 120); ga_grow(&ga, 120);
buf = ga.ga_data; buf = ga.ga_data;

View File

@ -678,9 +678,9 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
// otherwise "/$" will get stuck on end of line. // otherwise "/$" will get stuck on end of line.
while (matchpos.lnum == 0 while (matchpos.lnum == 0
&& (((options & SEARCH_END) && first_match) && (((options & SEARCH_END) && first_match)
? (nmatched == 1 ? (nmatched == 1
&& (int)endpos.col - 1 && (int)endpos.col - 1
< (int)start_pos.col + extra_col) < (int)start_pos.col + extra_col)
: ((int)matchpos.col : ((int)matchpos.col
- (ptr[matchpos.col] == NUL) - (ptr[matchpos.col] == NUL)
< (int)start_pos.col + extra_col))) { < (int)start_pos.col + extra_col))) {
@ -747,7 +747,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
// When putting the new cursor at the end, compare // When putting the new cursor at the end, compare
// relative to the end of the match. // relative to the end of the match.
match_ok = false; match_ok = false;
for (;;) { while (true) {
// Remember a position that is before the start // Remember a position that is before the start
// position, we use it if it's the last match in // position, we use it if it's the last match in
// the line. Always accept a position after // the line. Always accept a position after
@ -1079,7 +1079,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, long count, i
} }
// Repeat the search when pattern followed by ';', e.g. "/foo/;?bar". // Repeat the search when pattern followed by ';', e.g. "/foo/;?bar".
for (;;) { while (true) {
bool show_top_bot_msg = false; bool show_top_bot_msg = false;
searchstr = pat; searchstr = pat;
@ -1432,7 +1432,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char *pat)
if (buf->b_ml.ml_line_count == 0) { if (buf->b_ml.ml_line_count == 0) {
return FAIL; return FAIL;
} }
for (;;) { while (true) {
pos->lnum += dir; pos->lnum += dir;
if (pos->lnum < 1) { if (pos->lnum < 1) {
if (p_ws) { if (p_ws) {
@ -1544,7 +1544,7 @@ int searchc(cmdarg_T *cap, int t_cmd)
int len = (int)strlen(p); int len = (int)strlen(p);
while (count--) { while (count--) {
for (;;) { while (true) {
if (dir > 0) { if (dir > 0) {
col += utfc_ptr2len(p + col); col += utfc_ptr2len(p + col);
if (col >= len) { if (col >= len) {
@ -1810,7 +1810,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
if (linep[pos.col] == NUL && pos.col) { if (linep[pos.col] == NUL && pos.col) {
pos.col--; pos.col--;
} }
for (;;) { while (true) {
initc = utf_ptr2char(linep + pos.col); initc = utf_ptr2char(linep + pos.col);
if (initc == NUL) { if (initc == NUL) {
break; break;
@ -3621,7 +3621,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
} }
line = get_line_and_copy(lnum, file_line); line = get_line_and_copy(lnum, file_line);
for (;;) { while (true) {
if (incl_regmatch.regprog != NULL if (incl_regmatch.regprog != NULL
&& vim_regexec(&incl_regmatch, line, (colnr_T)0)) { && vim_regexec(&incl_regmatch, line, (colnr_T)0)) {
char *p_fname = (curr_fname == curbuf->b_fname) char *p_fname = (curr_fname == curbuf->b_fname)
@ -4090,7 +4090,7 @@ exit_matched:
} }
already = NULL; already = NULL;
} }
// End of big for (;;) loop. // End of big while (true) loop.
// Close any files that are still open. // Close any files that are still open.
for (i = 0; i <= depth; i++) { for (i = 0; i <= depth; i++) {
@ -4143,7 +4143,7 @@ static void show_pat_in_path(char *line, int type, bool did_show, int action, FI
if (got_int) { // 'q' typed at "--more--" message if (got_int) { // 'q' typed at "--more--" message
return; return;
} }
for (;;) { while (true) {
char *p = line + strlen(line) - 1; char *p = line + strlen(line) - 1;
if (fp != NULL) { if (fp != NULL) {
// We used fgets(), so get rid of newline at end // We used fgets(), so get rid of newline at end

View File

@ -3168,8 +3168,8 @@ int shada_read_everything(const char *const fname, const bool forceit, const boo
{ {
return shada_read_file(fname, return shada_read_file(fname,
kShaDaWantInfo|kShaDaWantMarks|kShaDaGetOldfiles kShaDaWantInfo|kShaDaWantMarks|kShaDaGetOldfiles
|(forceit?kShaDaForceit:0) |(forceit ? kShaDaForceit : 0)
|(missing_ok?0:kShaDaMissingError)); |(missing_ok ? 0 : kShaDaMissingError));
} }
static void shada_free_shada_entry(ShadaEntry *const entry) static void shada_free_shada_entry(ShadaEntry *const entry)

View File

@ -1201,7 +1201,7 @@ static void sign_define_cmd(char *sign_name, char *cmdline)
int failed = false; int failed = false;
// set values for a defined sign. // set values for a defined sign.
for (;;) { while (true) {
char *arg = skipwhite(p); char *arg = skipwhite(p);
if (*arg == NUL) { if (*arg == NUL) {
break; break;

View File

@ -389,7 +389,7 @@ size_t spell_check(win_T *wp, char *ptr, hlf_T *attrp, int *capcol, bool docount
if (mi.mi_lp->lp_slang->sl_fidxs != NULL) { if (mi.mi_lp->lp_slang->sl_fidxs != NULL) {
p = mi.mi_word; p = mi.mi_word;
char *fp = mi.mi_fword; char *fp = mi.mi_fword;
for (;;) { while (true) {
MB_PTR_ADV(p); MB_PTR_ADV(p);
MB_PTR_ADV(fp); MB_PTR_ADV(fp);
if (p >= mi.mi_end) { if (p >= mi.mi_end) {
@ -482,7 +482,7 @@ static void find_word(matchinf_T *mip, int mode)
// - there is a byte that doesn't match, // - there is a byte that doesn't match,
// - we reach the end of the tree, // - we reach the end of the tree,
// - or we reach the end of the line. // - or we reach the end of the line.
for (;;) { while (true) {
if (flen <= 0 && *mip->mi_fend != NUL) { if (flen <= 0 && *mip->mi_fend != NUL) {
flen = fold_more(mip); flen = fold_more(mip);
} }
@ -549,7 +549,7 @@ static void find_word(matchinf_T *mip, int mode)
// One space in the good word may stand for several spaces in the // One space in the good word may stand for several spaces in the
// checked word. // checked word.
if (c == ' ') { if (c == ' ') {
for (;;) { while (true) {
if (flen <= 0 && *mip->mi_fend != NUL) { if (flen <= 0 && *mip->mi_fend != NUL) {
flen = fold_more(mip); flen = fold_more(mip);
} }
@ -1081,7 +1081,7 @@ static void find_prefix(matchinf_T *mip, int mode)
// - there is a byte that doesn't match, // - there is a byte that doesn't match,
// - we reach the end of the tree, // - we reach the end of the tree,
// - or we reach the end of the line. // - or we reach the end of the line.
for (;;) { while (true) {
if (flen == 0 && *mip->mi_fend != NUL) { if (flen == 0 && *mip->mi_fend != NUL) {
flen = fold_more(mip); flen = fold_more(mip);
} }
@ -2558,7 +2558,7 @@ bool check_need_cap(linenr_T lnum, colnr_T col)
.rm_ic = false .rm_ic = false
}; };
char *p = line + endcol; char *p = line + endcol;
for (;;) { while (true) {
MB_PTR_BACK(line, p); MB_PTR_BACK(line, p);
if (p == line || spell_iswordp_nmw(p, curwin)) { if (p == line || spell_iswordp_nmw(p, curwin)) {
break; break;
@ -2796,7 +2796,7 @@ static void spell_soundfold_sofo(slang_T *slang, char *inword, char *res)
if (ip == NULL) { // empty list, can't match if (ip == NULL) { // empty list, can't match
c = NUL; c = NUL;
} else { } else {
for (;;) { // find "c" in the list while (true) { // find "c" in the list
if (*ip == 0) { // not found if (*ip == 0) { // not found
c = NUL; c = NUL;
break; break;

View File

@ -660,7 +660,7 @@ slang_T *spell_load_file(char *fname, char *lang, slang_T *old_lp, bool silent)
// <SECTIONS>: <section> ... <sectionend> // <SECTIONS>: <section> ... <sectionend>
// <section>: <sectionID> <sectionflags> <sectionlen> (section contents) // <section>: <sectionID> <sectionflags> <sectionlen> (section contents)
for (;;) { while (true) {
n = getc(fd); // <sectionID> or <sectionend> n = getc(fd); // <sectionID> or <sectionend>
if (n == SN_END) { if (n == SN_END) {
break; break;
@ -980,7 +980,7 @@ someerror:
ga_init(&ga, 1, 100); ga_init(&ga, 1, 100);
for (wordnr = 0; wordnr < wcount; wordnr++) { for (wordnr = 0; wordnr < wcount; wordnr++) {
ga.ga_len = 0; ga.ga_len = 0;
for (;;) { while (true) {
c = getc(fd); // <sugline> c = getc(fd); // <sugline>
if (c < 0) { if (c < 0) {
goto someerror; goto someerror;
@ -2973,7 +2973,7 @@ static bool flag_in_afflist(int flagtype, char *afflist, unsigned flag)
for (p = afflist; *p != NUL;) { for (p = afflist; *p != NUL;) {
int digits = getdigits_int(&p, true, 0); int digits = getdigits_int(&p, true, 0);
assert(digits >= 0); assert(digits >= 0);
n = (unsigned int)digits; n = (unsigned)digits;
if (n == 0) { if (n == 0) {
n = ZERO_FLAG; n = ZERO_FLAG;
} }
@ -3597,7 +3597,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
if (store_aff_word(spin, newword, ae->ae_flags, if (store_aff_word(spin, newword, ae->ae_flags,
affile, &affile->af_suff, xht, affile, &affile->af_suff, xht,
use_condit & (xht == NULL use_condit & (xht == NULL
? ~0 : ~CONDIT_SUF), ? ~0 : ~CONDIT_SUF),
use_flags, use_pfxlist, pfxlen) == FAIL) { use_flags, use_pfxlist, pfxlen) == FAIL) {
retval = FAIL; retval = FAIL;
} }
@ -4442,7 +4442,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
// round 1: SN_REP section // round 1: SN_REP section
// round 2: SN_SAL section (unless SN_SOFO is used) // round 2: SN_SAL section (unless SN_SOFO is used)
// round 3: SN_REPSAL section // round 3: SN_REPSAL section
for (unsigned int round = 1; round <= 3; round++) { for (unsigned round = 1; round <= 3; round++) {
garray_T *gap; garray_T *gap;
if (round == 1) { if (round == 1) {
gap = &spin->si_rep; gap = &spin->si_rep;
@ -4505,7 +4505,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
// <rep> : <repfromlen> <repfrom> <reptolen> <repto> // <rep> : <repfromlen> <repfrom> <reptolen> <repto>
// <sal> : <salfromlen> <salfrom> <saltolen> <salto> // <sal> : <salfromlen> <salfrom> <saltolen> <salto>
fromto_T *ftp = &((fromto_T *)gap->ga_data)[i]; fromto_T *ftp = &((fromto_T *)gap->ga_data)[i];
for (unsigned int rr = 1; rr <= 2; rr++) { for (unsigned rr = 1; rr <= 2; rr++) {
char *p = rr == 1 ? ftp->ft_from : ftp->ft_to; char *p = rr == 1 ? ftp->ft_from : ftp->ft_to;
l = strlen(p); l = strlen(p);
assert(l < INT_MAX); assert(l < INT_MAX);
@ -4542,7 +4542,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
// round 1: count the bytes // round 1: count the bytes
// round 2: write the bytes // round 2: write the bytes
for (unsigned int round = 1; round <= 2; round++) { for (unsigned round = 1; round <= 2; round++) {
size_t todo; size_t todo;
size_t len = 0; size_t len = 0;
hashitem_T *hi; hashitem_T *hi;
@ -4665,7 +4665,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
// <LWORDTREE> <KWORDTREE> <PREFIXTREE> // <LWORDTREE> <KWORDTREE> <PREFIXTREE>
spin->si_memtot = 0; spin->si_memtot = 0;
for (unsigned int round = 1; round <= 3; round++) { for (unsigned round = 1; round <= 3; round++) {
wordnode_T *tree; wordnode_T *tree;
if (round == 1) { if (round == 1) {
tree = spin->si_foldroot->wn_sibling; tree = spin->si_foldroot->wn_sibling;

View File

@ -1926,7 +1926,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// skip over NUL bytes // skip over NUL bytes
n = sp->ts_arridx; n = sp->ts_arridx;
for (;;) { while (true) {
if (sp->ts_curi > byts[n]) { if (sp->ts_curi > byts[n]) {
// Only NUL bytes at this node, go to next state. // Only NUL bytes at this node, go to next state.
PROF_STORE(sp->ts_state) PROF_STORE(sp->ts_state)
@ -2959,7 +2959,7 @@ static int soundfold_find(slang_T *slang, char *word)
uint8_t *byts = slang->sl_sbyts; uint8_t *byts = slang->sl_sbyts;
idx_T *idxs = slang->sl_sidxs; idx_T *idxs = slang->sl_sidxs;
for (;;) { while (true) {
// First byte is the number of possible bytes. // First byte is the number of possible bytes.
int len = byts[arridx++]; int len = byts[arridx++];
@ -3077,7 +3077,7 @@ static void add_suggestion(suginfo_T *su, garray_T *gap, const char *goodword, i
// "thee the" is added next to changing the first "the" the "thee". // "thee the" is added next to changing the first "the" the "thee".
const char *pgood = goodword + strlen(goodword); const char *pgood = goodword + strlen(goodword);
char *pbad = su->su_badptr + badlenarg; char *pbad = su->su_badptr + badlenarg;
for (;;) { while (true) {
goodlen = (int)(pgood - goodword); goodlen = (int)(pgood - goodword);
badlen = (int)(pbad - su->su_badptr); badlen = (int)(pbad - su->su_badptr);
if (goodlen <= 0 || badlen <= 0) { if (goodlen <= 0 || badlen <= 0) {
@ -3671,9 +3671,9 @@ static int spell_edit_score_limit_w(slang_T *slang, const char *badword, const c
int score = 0; int score = 0;
int minscore = limit + 1; int minscore = limit + 1;
for (;;) { while (true) {
// Skip over an equal part, score remains the same. // Skip over an equal part, score remains the same.
for (;;) { while (true) {
bc = wbadword[bi]; bc = wbadword[bi];
gc = wgoodword[gi]; gc = wgoodword[gi];

View File

@ -36,7 +36,7 @@
void state_enter(VimState *s) void state_enter(VimState *s)
{ {
for (;;) { while (true) {
int check_result = s->check ? s->check(s) : 1; int check_result = s->check ? s->check(s) : 1;
if (!check_result) { if (!check_result) {
@ -135,7 +135,7 @@ void state_handle_k_event(void)
/// Return true if in the current mode we need to use virtual. /// Return true if in the current mode we need to use virtual.
bool virtual_active(void) bool virtual_active(void)
{ {
unsigned int cur_ve_flags = get_ve_flags(); unsigned cur_ve_flags = get_ve_flags();
// While an operator is being executed we return "virtual_op", because // While an operator is being executed we return "virtual_op", because
// VIsual_active has already been reset, thus we can't check for "block" // VIsual_active has already been reset, thus we can't check for "block"

View File

@ -2000,7 +2000,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// string to find the last character that will fit. // string to find the last character that will fit.
trunc_p = out; trunc_p = out;
width = 0; width = 0;
for (;;) { while (true) {
width += ptr2cells(trunc_p); width += ptr2cells(trunc_p);
if (width >= maxwidth) { if (width >= maxwidth) {
break; break;

View File

@ -373,7 +373,7 @@ int vim_stricmp(const char *s1, const char *s2)
{ {
int i; int i;
for (;;) { while (true) {
i = (int)TOLOWER_LOC((uint8_t)(*s1)) - (int)TOLOWER_LOC((uint8_t)(*s2)); i = (int)TOLOWER_LOC((uint8_t)(*s1)) - (int)TOLOWER_LOC((uint8_t)(*s2));
if (i != 0) { if (i != 0) {
return i; // this character different return i; // this character different
@ -831,10 +831,10 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
} else if (ascii_isdigit((int)(*p))) { } else if (ascii_isdigit((int)(*p))) {
// size_t could be wider than unsigned int; make sure we treat // size_t could be wider than unsigned int; make sure we treat
// argument like common implementations do // argument like common implementations do
unsigned int uj = (unsigned)(*p++ - '0'); unsigned uj = (unsigned)(*p++ - '0');
while (ascii_isdigit((int)(*p))) { while (ascii_isdigit((int)(*p))) {
uj = 10 * uj + (unsigned int)(*p++ - '0'); uj = 10 * uj + (unsigned)(*p++ - '0');
} }
min_field_width = uj; min_field_width = uj;
} }
@ -855,10 +855,10 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
} else if (ascii_isdigit((int)(*p))) { } else if (ascii_isdigit((int)(*p))) {
// size_t could be wider than unsigned int; make sure we // size_t could be wider than unsigned int; make sure we
// treat argument like common implementations do // treat argument like common implementations do
unsigned int uj = (unsigned)(*p++ - '0'); unsigned uj = (unsigned)(*p++ - '0');
while (ascii_isdigit((int)(*p))) { while (ascii_isdigit((int)(*p))) {
uj = 10 * uj + (unsigned int)(*p++ - '0'); uj = 10 * uj + (unsigned)(*p++ - '0');
} }
precision = uj; precision = uj;
} }
@ -1030,10 +1030,10 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
// unsigned // unsigned
switch (length_modifier) { switch (length_modifier) {
case '\0': case '\0':
uarg = (unsigned int)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned int)); uarg = (unsigned)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned));
break; break;
case 'h': case 'h':
uarg = (uint16_t)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned int)); uarg = (uint16_t)(tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned));
break; break;
case 'l': case 'l':
uarg = (tvs ? (unsigned long)tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned long)); uarg = (tvs ? (unsigned long)tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned long));

View File

@ -619,7 +619,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
for (current_lnum = lnum; current_lnum < end_lnum; current_lnum++) { for (current_lnum = lnum; current_lnum < end_lnum; current_lnum++) {
syn_start_line(); syn_start_line();
for (;;) { while (true) {
had_sync_point = syn_finish_line(true); had_sync_point = syn_finish_line(true);
// When a sync point has been found, remember where, and // When a sync point has been found, remember where, and
// continue to look for another one, further on in the line. // continue to look for another one, further on in the line.
@ -2070,7 +2070,7 @@ static void check_state_ends(void)
int had_extend; int had_extend;
cur_si = &CUR_STATE(current_state.ga_len - 1); cur_si = &CUR_STATE(current_state.ga_len - 1);
for (;;) { while (true) {
if (cur_si->si_ends if (cur_si->si_ends
&& (cur_si->si_m_endpos.lnum < current_lnum && (cur_si->si_m_endpos.lnum < current_lnum
|| (cur_si->si_m_endpos.lnum == current_lnum || (cur_si->si_m_endpos.lnum == current_lnum
@ -2383,7 +2383,7 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_
} }
// Find the SKIP or first END pattern after the last START pattern. // Find the SKIP or first END pattern after the last START pattern.
for (;;) { while (true) {
spp = &(SYN_ITEMS(syn_block)[idx]); spp = &(SYN_ITEMS(syn_block)[idx]);
if (spp->sp_type != SPTYPE_START) { if (spp->sp_type != SPTYPE_START) {
break; break;
@ -2410,7 +2410,7 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_
// use syntax iskeyword option // use syntax iskeyword option
save_chartab(buf_chartab); save_chartab(buf_chartab);
for (;;) { while (true) {
// Find end pattern that matches first after "matchcol". // Find end pattern that matches first after "matchcol".
best_idx = -1; best_idx = -1;
for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; idx++) { for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; idx++) {
@ -3838,7 +3838,7 @@ static char *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, i
opt->flags |= HL_CONCEAL; opt->flags |= HL_CONCEAL;
} }
for (;;) { while (true) {
// This is used very often when a large number of keywords is defined. // This is used very often when a large number of keywords is defined.
// Need to skip quickly when no option name is found. // Need to skip quickly when no option name is found.
// Also avoid tolower(), it's slow. // Also avoid tolower(), it's slow.
@ -4675,7 +4675,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
} }
scl_id -= SYNID_CLUSTER; scl_id -= SYNID_CLUSTER;
for (;;) { while (true) {
if (STRNICMP(rest, "add", 3) == 0 if (STRNICMP(rest, "add", 3) == 0
&& (ascii_iswhite(rest[3]) || rest[3] == '=')) { && (ascii_iswhite(rest[3]) || rest[3] == '=')) {
opt_len = 3; opt_len = 3;

View File

@ -538,7 +538,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
} }
// Repeat searching for tags, when a file has not been found. // Repeat searching for tags, when a file has not been found.
for (;;) { while (true) {
int other_name; int other_name;
char *name; char *name;
@ -1260,9 +1260,9 @@ static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flag
vim_snprintf(flagString, sizeof(flagString), vim_snprintf(flagString, sizeof(flagString),
"%s%s%s", "%s%s%s",
g_tag_at_cursor ? "c": "", g_tag_at_cursor ? "c" : "",
flags & TAG_INS_COMP ? "i": "", flags & TAG_INS_COMP ? "i" : "",
flags & TAG_REGEXP ? "r": ""); flags & TAG_REGEXP ? "r" : "");
save_pos = curwin->w_cursor; save_pos = curwin->w_cursor;
result = callback_call(&curbuf->b_tfu_cb, 3, args, &rettv); result = callback_call(&curbuf->b_tfu_cb, 3, args, &rettv);
@ -2094,7 +2094,7 @@ static void findtags_get_all_tags(findtags_state_T *st, findtags_match_args_T *m
CLEAR_FIELD(search_info); CLEAR_FIELD(search_info);
// Read and parse the lines in the file one by one // Read and parse the lines in the file one by one
for (;;) { while (true) {
// check for CTRL-C typed, more often when jumping around // check for CTRL-C typed, more often when jumping around
if (st->state == TS_BINARY || st->state == TS_SKIP_BACK) { if (st->state == TS_BINARY || st->state == TS_SKIP_BACK) {
line_breakcheck(); line_breakcheck();
@ -2558,7 +2558,7 @@ int get_tagfname(tagname_T *tnp, int first, char *buf)
// There are two states: // There are two states:
// tnp->tn_did_filefind_init == false: setup for next part in 'tags'. // tnp->tn_did_filefind_init == false: setup for next part in 'tags'.
// tnp->tn_did_filefind_init == true: find next file in this part. // tnp->tn_did_filefind_init == true: find next file in this part.
for (;;) { while (true) {
if (tnp->tn_did_filefind_init) { if (tnp->tn_did_filefind_init) {
fname = vim_findfile(tnp->tn_search_ctx); fname = vim_findfile(tnp->tn_search_ctx);
if (fname != NULL) { if (fname != NULL) {
@ -3168,7 +3168,7 @@ static int find_extra(char **pp)
char first_char = **pp; char first_char = **pp;
// Repeat for addresses separated with ';' // Repeat for addresses separated with ';'
for (;;) { while (true) {
if (ascii_isdigit(*str)) { if (ascii_isdigit(*str)) {
str = skipdigits(str + 1); str = skipdigits(str + 1);
} else if (*str == '/' || *str == '?') { } else if (*str == '/' || *str == '?') {

View File

@ -680,7 +680,7 @@ void terminal_send(Terminal *term, char *data, size_t size)
static bool is_filter_char(int c) static bool is_filter_char(int c)
{ {
unsigned int flag = 0; unsigned flag = 0;
switch (c) { switch (c) {
case 0x08: case 0x08:
flag = TPF_BS; flag = TPF_BS;
@ -839,7 +839,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr, int *te
| (cell.attrs.italic ? HL_ITALIC : 0) | (cell.attrs.italic ? HL_ITALIC : 0)
| (cell.attrs.reverse ? HL_INVERSE : 0) | (cell.attrs.reverse ? HL_INVERSE : 0)
| get_underline_hl_flag(cell.attrs) | get_underline_hl_flag(cell.attrs)
| (cell.attrs.strike ? HL_STRIKETHROUGH: 0) | (cell.attrs.strike ? HL_STRIKETHROUGH : 0)
| ((fg_indexed && !fg_set) ? HL_FG_INDEXED : 0) | ((fg_indexed && !fg_set) ? HL_FG_INDEXED : 0)
| ((bg_indexed && !bg_set) ? HL_BG_INDEXED : 0); | ((bg_indexed && !bg_set) ? HL_BG_INDEXED : 0);

View File

@ -318,7 +318,7 @@ void internal_format(int textwidth, int second_indent, int flags, bool format_on
if (allow_break) { if (allow_break) {
// Break only when we are not at end of line. // Break only when we are not at end of line.
end_foundcol = foundcol = ncc == NUL? 0 : curwin->w_cursor.col; end_foundcol = foundcol = ncc == NUL ? 0 : curwin->w_cursor.col;
break; break;
} }
curwin->w_cursor.col = col; curwin->w_cursor.col = col;

View File

@ -104,7 +104,7 @@ int findsent(Direction dir, long count)
const int startlnum = pos.lnum; const int startlnum = pos.lnum;
const bool cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL; const bool cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL;
for (;;) { // find end of sentence while (true) { // find end of sentence
c = gchar_pos(&pos); c = gchar_pos(&pos);
if (c == NUL || (pos.col == 0 && startPS(pos.lnum, NUL, false))) { if (c == NUL || (pos.col == 0 && startPS(pos.lnum, NUL, false))) {
if (dir == BACKWARD && pos.lnum != startlnum) { if (dir == BACKWARD && pos.lnum != startlnum) {
@ -540,7 +540,7 @@ static void back_in_line(void)
int sclass; // starting class int sclass; // starting class
sclass = cls(); sclass = cls();
for (;;) { while (true) {
if (curwin->w_cursor.col == 0) { // stop at start of line if (curwin->w_cursor.col == 0) { // stop at start of line
break; break;
} }
@ -1062,7 +1062,7 @@ static bool in_html_tag(bool end_tag)
} }
// check that the matching '>' is not preceded by '/' // check that the matching '>' is not preceded by '/'
for (;;) { while (true) {
if (inc(&pos) < 0) { if (inc(&pos) < 0) {
return false; return false;
} }
@ -1304,7 +1304,7 @@ extend:
start_lnum -= dir; start_lnum -= dir;
break; break;
} }
for (;;) { while (true) {
if (start_lnum == (dir == BACKWARD if (start_lnum == (dir == BACKWARD
? 1 : curbuf->b_ml.ml_line_count)) { ? 1 : curbuf->b_ml.ml_line_count)) {
break; break;
@ -1431,7 +1431,7 @@ extend:
/// @return column number of "quotechar" or -1 when not found. /// @return column number of "quotechar" or -1 when not found.
static int find_next_quote(char *line, int col, int quotechar, char *escape) static int find_next_quote(char *line, int col, int quotechar, char *escape)
{ {
for (;;) { while (true) {
int c = (uint8_t)line[col]; int c = (uint8_t)line[col];
if (c == NUL) { if (c == NUL) {
return -1; return -1;
@ -1605,7 +1605,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
// Also do this when there is a Visual area, a' may leave the cursor // Also do this when there is a Visual area, a' may leave the cursor
// in between two strings. // in between two strings.
col_start = 0; col_start = 0;
for (;;) { while (true) {
// Find open quote character. // Find open quote character.
col_start = find_next_quote(line, col_start, quotechar, NULL); col_start = find_next_quote(line, col_start, quotechar, NULL);
if (col_start < 0 || col_start > first_col) { if (col_start < 0 || col_start > first_col) {

View File

@ -209,7 +209,7 @@ void tui_enable_extkeys(TUIData *tui)
unibi_out_ext(tui, tui->unibi_ext.enable_extended_keys); unibi_out_ext(tui, tui->unibi_ext.enable_extended_keys);
} }
static size_t unibi_pre_fmt_str(TUIData *tui, unsigned int unibi_index, char *buf, size_t len) static size_t unibi_pre_fmt_str(TUIData *tui, unsigned unibi_index, char *buf, size_t len)
{ {
const char *str = unibi_get_str(tui->ut, unibi_index); const char *str = unibi_get_str(tui->ut, unibi_index);
if (!str) { if (!str) {
@ -1617,7 +1617,7 @@ static void pad(void *ctx, size_t delay, int scale FUNC_ATTR_UNUSED, int force)
} }
flush_buf(tui); flush_buf(tui);
uv_sleep((unsigned int)(delay/10)); uv_sleep((unsigned)(delay/10));
} }
static void unibi_set_if_empty(unibi_term *ut, enum unibi_string str, const char *val) static void unibi_set_if_empty(unibi_term *ut, enum unibi_string str, const char *val)

View File

@ -580,11 +580,11 @@ void ui_comp_msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep
&& (msg_current_row < Rows || (scrolled && !msg_was_scrolled))) { && (msg_current_row < Rows || (scrolled && !msg_was_scrolled))) {
int delta = msg_current_row - (int)row; int delta = msg_current_row - (int)row;
if (msg_grid.blending) { if (msg_grid.blending) {
int first_row = MAX((int)row - (scrolled?1:0), 0); int first_row = MAX((int)row - (scrolled ? 1 : 0), 0);
compose_area(first_row, Rows - delta, 0, Columns); compose_area(first_row, Rows - delta, 0, Columns);
} else { } else {
// scroll separator together with message text // scroll separator together with message text
int first_row = MAX((int)row - (msg_was_scrolled?1:0), 0); int first_row = MAX((int)row - (msg_was_scrolled ? 1 : 0), 0);
ui_composed_call_grid_scroll(1, first_row, Rows, 0, Columns, delta, 0); ui_composed_call_grid_scroll(1, first_row, Rows, 0, Columns, delta, 0);
if (scrolled && !msg_was_scrolled && row > 0) { if (scrolled && !msg_was_scrolled && row > 0) {
compose_area(row - 1, row, 0, Columns); compose_area(row - 1, row, 0, Columns);
@ -602,8 +602,8 @@ void ui_comp_msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep
static bool curgrid_covered_above(int row) static bool curgrid_covered_above(int row)
{ {
bool above_msg = (kv_A(layers, kv_size(layers) - 1) == &msg_grid bool above_msg = (kv_A(layers, kv_size(layers) - 1) == &msg_grid
&& row < msg_current_row - (msg_was_scrolled?1:0)); && row < msg_current_row - (msg_was_scrolled ? 1 : 0));
return kv_size(layers) - (above_msg?1:0) > curgrid->comp_index + 1; return kv_size(layers) - (above_msg ? 1 : 0) > curgrid->comp_index + 1;
} }
void ui_comp_grid_scroll(Integer grid, Integer top, Integer bot, Integer left, Integer right, void ui_comp_grid_scroll(Integer grid, Integer top, Integer bot, Integer left, Integer right,

View File

@ -904,7 +904,7 @@ static u_header_T *unserialize_uhp(bufinfo_T *bi, const char *file_name)
uhp->uh_time = undo_read_time(bi); uhp->uh_time = undo_read_time(bi);
// Unserialize optional fields. // Unserialize optional fields.
for (;;) { while (true) {
int len = undo_read_byte(bi); int len = undo_read_byte(bi);
if (len == EOF) { if (len == EOF) {
@ -1471,7 +1471,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT
// Optional header fields. // Optional header fields.
long last_save_nr = 0; long last_save_nr = 0;
for (;;) { while (true) {
int len = undo_read_byte(&bi); int len = undo_read_byte(&bi);
if (len == 0 || len == EOF) { if (len == 0 || len == EOF) {
@ -2024,7 +2024,7 @@ void undo_time(long step, bool sec, bool file, bool absolute)
while (uhp != NULL) { while (uhp != NULL) {
uhp->uh_walk = mark; uhp->uh_walk = mark;
long val = dosec ? (long)(uhp->uh_time) : long val = dosec ? (long)(uhp->uh_time) :
dofile ? uhp->uh_save_nr dofile ? uhp->uh_save_nr
: uhp->uh_seq; : uhp->uh_seq;

View File

@ -139,7 +139,7 @@ char *find_ucmd(exarg_T *eap, char *p, int *full, expand_T *xp, int *complp)
// Look for buffer-local user commands first, then global ones. // Look for buffer-local user commands first, then global ones.
gap = &prevwin_curwin()->w_buffer->b_ucmds; gap = &prevwin_curwin()->w_buffer->b_ucmds;
for (;;) { while (true) {
for (j = 0; j < gap->ga_len; j++) { for (j = 0; j < gap->ga_len; j++) {
uc = USER_CMD_GA(gap, j); uc = USER_CMD_GA(gap, j);
cp = eap->cmd; cp = eap->cmd;
@ -445,7 +445,7 @@ static void uc_list(char *name, size_t name_len)
// In cmdwin, the alternative buffer should be used. // In cmdwin, the alternative buffer should be used.
const garray_T *gap = &prevwin_curwin()->w_buffer->b_ucmds; const garray_T *gap = &prevwin_curwin()->w_buffer->b_ucmds;
for (;;) { while (true) {
for (i = 0; i < gap->ga_len; i++) { for (i = 0; i < gap->ga_len; i++) {
cmd = USER_CMD_GA(gap, i); cmd = USER_CMD_GA(gap, i);
a = cmd->uc_argt; a = cmd->uc_argt;
@ -1066,7 +1066,7 @@ void ex_delcommand(exarg_T *eap)
} }
gap = &curbuf->b_ucmds; gap = &curbuf->b_ucmds;
for (;;) { while (true) {
for (i = 0; i < gap->ga_len; i++) { for (i = 0; i < gap->ga_len; i++) {
cmd = USER_CMD_GA(gap, i); cmd = USER_CMD_GA(gap, i);
res = strcmp(arg, cmd->uc_name); res = strcmp(arg, cmd->uc_name);
@ -1645,12 +1645,12 @@ int do_ucmd(exarg_T *eap, bool preview)
// First round: "buf" is NULL, compute length, allocate "buf". // First round: "buf" is NULL, compute length, allocate "buf".
// Second round: copy result into "buf". // Second round: copy result into "buf".
buf = NULL; buf = NULL;
for (;;) { while (true) {
p = cmd->uc_rep; // source p = cmd->uc_rep; // source
q = buf; // destination q = buf; // destination
totlen = 0; totlen = 0;
for (;;) { while (true) {
start = vim_strchr(p, '<'); start = vim_strchr(p, '<');
if (start != NULL) { if (start != NULL) {
end = vim_strchr(start + 1, '>'); end = vim_strchr(start + 1, '>');

View File

@ -2886,7 +2886,7 @@ int win_close(win_T *win, bool free_buf, bool force)
if (wp->w_p_pvw || bt_quickfix(wp->w_buffer)) { if (wp->w_p_pvw || bt_quickfix(wp->w_buffer)) {
// If the cursor goes to the preview or the quickfix window, try // If the cursor goes to the preview or the quickfix window, try
// finding another window to go to. // finding another window to go to.
for (;;) { while (true) {
if (wp->w_next == NULL) { if (wp->w_next == NULL) {
wp = firstwin; wp = firstwin;
} else { } else {
@ -4639,7 +4639,7 @@ win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count)
// First go upwards in the tree of frames until we find an upwards or // First go upwards in the tree of frames until we find an upwards or
// downwards neighbor. // downwards neighbor.
frame_T *fr = foundfr; frame_T *fr = foundfr;
for (;;) { while (true) {
if (fr == tp->tp_topframe) { if (fr == tp->tp_topframe) {
goto end; goto end;
} }
@ -4655,7 +4655,7 @@ win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count)
} }
// Now go downwards to find the bottom or top frame in it. // Now go downwards to find the bottom or top frame in it.
for (;;) { while (true) {
if (nfr->fr_layout == FR_LEAF) { if (nfr->fr_layout == FR_LEAF) {
foundfr = nfr; foundfr = nfr;
break; break;
@ -4715,7 +4715,7 @@ win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count)
// First go upwards in the tree of frames until we find a left or // First go upwards in the tree of frames until we find a left or
// right neighbor. // right neighbor.
frame_T *fr = foundfr; frame_T *fr = foundfr;
for (;;) { while (true) {
if (fr == tp->tp_topframe) { if (fr == tp->tp_topframe) {
goto end; goto end;
} }
@ -4731,7 +4731,7 @@ win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count)
} }
// Now go downwards to find the leftmost or rightmost frame in it. // Now go downwards to find the leftmost or rightmost frame in it.
for (;;) { while (true) {
if (nfr->fr_layout == FR_LEAF) { if (nfr->fr_layout == FR_LEAF) {
foundfr = nfr; foundfr = nfr;
break; break;
@ -5378,7 +5378,7 @@ static dict_T *make_win_info_dict(int width, int height, int topline, int topfil
d->dv_refcount = 1; d->dv_refcount = 1;
// not actually looping, for breaking out on error // not actually looping, for breaking out on error
while (1) { while (true) {
typval_T tv = { typval_T tv = {
.v_lock = VAR_UNLOCKED, .v_lock = VAR_UNLOCKED,
.v_type = VAR_NUMBER, .v_type = VAR_NUMBER,
@ -6759,7 +6759,7 @@ void command_height(void)
static void frame_add_height(frame_T *frp, int n) static void frame_add_height(frame_T *frp, int n)
{ {
frame_new_height(frp, frp->fr_height + n, false, false); frame_new_height(frp, frp->fr_height + n, false, false);
for (;;) { while (true) {
frp = frp->fr_parent; frp = frp->fr_parent;
if (frp == NULL) { if (frp == NULL) {
break; break;
@ -7426,7 +7426,7 @@ const char *check_colorcolumn(win_T *wp)
return NULL; // buffer was closed return NULL; // buffer was closed
} }
unsigned int count = 0; unsigned count = 0;
int color_cols[256]; int color_cols[256];
for (char *s = wp->w_p_cc; *s != NUL && count < 255;) { for (char *s = wp->w_p_cc; *s != NUL && count < 255;) {
int col; int col;
@ -7479,7 +7479,7 @@ skip:
qsort(color_cols, count, sizeof(int), int_cmp); qsort(color_cols, count, sizeof(int), int_cmp);
int j = 0; int j = 0;
for (unsigned int i = 0; i < count; i++) { for (unsigned i = 0; i < count; i++) {
// skip duplicates // skip duplicates
if (j == 0 || wp->w_p_cc_cols[j - 1] != color_cols[i]) { if (j == 0 || wp->w_p_cc_cols[j - 1] != color_cols[i]) {
wp->w_p_cc_cols[j++] = color_cols[i]; wp->w_p_cc_cols[j++] = color_cols[i];

View File

@ -928,7 +928,7 @@ sp_cond_colon_before = ignore # ignore/add/remove/force/not_defined
sp_cond_colon_after = ignore # ignore/add/remove/force/not_defined sp_cond_colon_after = ignore # ignore/add/remove/force/not_defined
# Add or remove space around the '?' in 'b ? t : f'. # Add or remove space around the '?' in 'b ? t : f'.
sp_cond_question = ignore # ignore/add/remove/force/not_defined sp_cond_question = force # ignore/add/remove/force/not_defined
# Add or remove space before the '?' in 'b ? t : f'. # Add or remove space before the '?' in 'b ? t : f'.
# #
@ -3234,31 +3234,31 @@ mod_enum_last_comma = add # ignore/add/remove/force/not_defined
# Infinite loops that do not already match one of these syntaxes are ignored. # Infinite loops that do not already match one of these syntaxes are ignored.
# Other options that affect loop formatting will be applied after transforming # Other options that affect loop formatting will be applied after transforming
# the syntax. # the syntax.
mod_infinite_loop = 0 # unsigned number mod_infinite_loop = 2 # unsigned number
# Add or remove the 'int' keyword in 'int short'. # Add or remove the 'int' keyword in 'int short'.
mod_int_short = ignore # ignore/add/remove/force/not_defined mod_int_short = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'short int'. # Add or remove the 'int' keyword in 'short int'.
mod_short_int = ignore # ignore/add/remove/force/not_defined mod_short_int = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'int long'. # Add or remove the 'int' keyword in 'int long'.
mod_int_long = ignore # ignore/add/remove/force/not_defined mod_int_long = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'long int'. # Add or remove the 'int' keyword in 'long int'.
mod_long_int = ignore # ignore/add/remove/force/not_defined mod_long_int = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'int signed'. # Add or remove the 'int' keyword in 'int signed'.
mod_int_signed = ignore # ignore/add/remove/force/not_defined mod_int_signed = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'signed int'. # Add or remove the 'int' keyword in 'signed int'.
mod_signed_int = ignore # ignore/add/remove/force/not_defined mod_signed_int = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'int unsigned'. # Add or remove the 'int' keyword in 'int unsigned'.
mod_int_unsigned = ignore # ignore/add/remove/force/not_defined mod_int_unsigned = remove # ignore/add/remove/force/not_defined
# Add or remove the 'int' keyword in 'unsigned int'. # Add or remove the 'int' keyword in 'unsigned int'.
mod_unsigned_int = ignore # ignore/add/remove/force/not_defined mod_unsigned_int = remove # ignore/add/remove/force/not_defined
# If there is a situation where mod_int_* and mod_*_int would result in # If there is a situation where mod_int_* and mod_*_int would result in
# multiple int keywords, whether to keep the rightmost int (the default) or the # multiple int keywords, whether to keep the rightmost int (the default) or the
@ -3615,5 +3615,5 @@ set CLASS_COLON REAL_FATTR_CONST
set CLASS_COLON REAL_FATTR_NONNULL_ALL set CLASS_COLON REAL_FATTR_NONNULL_ALL
set CLASS_COLON REAL_FATTR_PURE set CLASS_COLON REAL_FATTR_PURE
set CLASS_COLON REAL_FATTR_WARN_UNUSED_RESULT set CLASS_COLON REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 117 # option(s) with 'not default' value: 127
# #