aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-04-26 23:23:44 +0200
committerGitHub <noreply@github.com>2023-04-26 23:23:44 +0200
commit3b0df1780e2c8526bda5dead18ee7cc45925caba (patch)
treec8415dc986f1cd3ddf6044b4ec0318a089db3ed7 /src
parent7d0479c55810af9bf9f115ba69d1419ea81ec41e (diff)
downloadrneovim-3b0df1780e2c8526bda5dead18ee7cc45925caba.tar.gz
rneovim-3b0df1780e2c8526bda5dead18ee7cc45925caba.tar.bz2
rneovim-3b0df1780e2c8526bda5dead18ee7cc45925caba.zip
refactor: uncrustify
Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/extmark.c2
-rw-r--r--src/nvim/api/options.c2
-rw-r--r--src/nvim/api/private/converter.c4
-rw-r--r--src/nvim/arglist.c4
-rw-r--r--src/nvim/autocmd.c2
-rw-r--r--src/nvim/buffer.c8
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/bufwrite.c4
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/charset.c4
-rw-r--r--src/nvim/cursor.c2
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--src/nvim/decoration.c2
-rw-r--r--src/nvim/diff.c14
-rw-r--r--src/nvim/digraph.c2
-rw-r--r--src/nvim/drawline.c2
-rw-r--r--src/nvim/drawscreen.c8
-rw-r--r--src/nvim/edit.c8
-rw-r--r--src/nvim/eval.c18
-rw-r--r--src/nvim/eval/buffer.c2
-rw-r--r--src/nvim/eval/encode.c4
-rw-r--r--src/nvim/eval/funcs.c16
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/eval/userfunc.c4
-rw-r--r--src/nvim/eval/vars.c6
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_docmd.c10
-rw-r--r--src/nvim/ex_eval.c6
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/file_search.c10
-rw-r--r--src/nvim/fileio.c12
-rw-r--r--src/nvim/fold.c16
-rw-r--r--src/nvim/getchar.c12
-rw-r--r--src/nvim/hashtab.c2
-rw-r--r--src/nvim/indent.c6
-rw-r--r--src/nvim/indent_c.c14
-rw-r--r--src/nvim/input.c4
-rw-r--r--src/nvim/insexpand.c4
-rw-r--r--src/nvim/keycodes.c12
-rw-r--r--src/nvim/lua/executor.c2
-rw-r--r--src/nvim/lua/spell.c6
-rw-r--r--src/nvim/lua/stdlib.c4
-rw-r--r--src/nvim/lua/treesitter.c2
-rw-r--r--src/nvim/lua/xdiff.c8
-rw-r--r--src/nvim/mapping.c14
-rw-r--r--src/nvim/mark.c2
-rw-r--r--src/nvim/marktree.c2
-rw-r--r--src/nvim/marktree.h2
-rw-r--r--src/nvim/match.c6
-rw-r--r--src/nvim/mbyte.c20
-rw-r--r--src/nvim/memfile.c2
-rw-r--r--src/nvim/memline.c12
-rw-r--r--src/nvim/memory.c2
-rw-r--r--src/nvim/menu.c2
-rw-r--r--src/nvim/message.c8
-rw-r--r--src/nvim/mouse.c6
-rw-r--r--src/nvim/move.c2
-rw-r--r--src/nvim/normal.c8
-rw-r--r--src/nvim/ops.c10
-rw-r--r--src/nvim/option.c4
-rw-r--r--src/nvim/option_defs.h6
-rw-r--r--src/nvim/optionstr.c12
-rw-r--r--src/nvim/os/env.c2
-rw-r--r--src/nvim/os/fs.c2
-rw-r--r--src/nvim/os/input.c4
-rw-r--r--src/nvim/os/process.c2
-rw-r--r--src/nvim/os/shell.c2
-rw-r--r--src/nvim/plines.c12
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--src/nvim/quickfix.c8
-rw-r--r--src/nvim/regexp.c6
-rw-r--r--src/nvim/regexp_bt.c12
-rw-r--r--src/nvim/regexp_nfa.c8
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/search.c22
-rw-r--r--src/nvim/shada.c4
-rw-r--r--src/nvim/sign.c2
-rw-r--r--src/nvim/spell.c12
-rw-r--r--src/nvim/spellfile.c16
-rw-r--r--src/nvim/spellsuggest.c10
-rw-r--r--src/nvim/state.c4
-rw-r--r--src/nvim/statusline.c2
-rw-r--r--src/nvim/strings.c14
-rw-r--r--src/nvim/syntax.c12
-rw-r--r--src/nvim/tag.c14
-rw-r--r--src/nvim/terminal.c4
-rw-r--r--src/nvim/textformat.c2
-rw-r--r--src/nvim/textobject.c12
-rw-r--r--src/nvim/tui/tui.c4
-rw-r--r--src/nvim/ui_compositor.c8
-rw-r--r--src/nvim/undo.c6
-rw-r--r--src/nvim/usercmd.c10
-rw-r--r--src/nvim/window.c18
-rw-r--r--src/uncrustify.cfg22
94 files changed, 324 insertions, 324 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index eb49587d03..b781da1dc3 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -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_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);
return true;
} else {
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 467a4720a6..2d1b170d2d 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -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 win-local options -> setglobal and setlocal (opt_flags == 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, {
access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err);
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index 7d04d883f5..a62f975cfd 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -51,7 +51,7 @@ typedef struct {
const size_t len_ = (size_t)(len); \
const char *const str_ = (str); \
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)
#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:
tv->v_type = VAR_BOOL;
- tv->vval.v_bool = obj.data.boolean? kBoolVarTrue: kBoolVarFalse;
+ tv->vval.v_bool = obj.data.boolean ? kBoolVarTrue : kBoolVarFalse;
break;
case kObjectTypeBuffer:
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 6e3fc62c5b..284c94a712 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -852,7 +852,7 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
if (aall->had_tab > 0) {
goto_tabpage_tp(first_tabpage, true, true);
}
- for (;;) {
+ while (true) {
win_T *wpnext = NULL;
tabpage_T *tpnext = curtab->tp_next;
for (win_T *wp = firstwin; wp != NULL; wp = wpnext) {
@@ -1148,7 +1148,7 @@ char *arg_all(void)
// Do this loop two times:
// first time: compute the total length
// second time: concatenate the names
- for (;;) {
+ while (true) {
int len = 0;
for (int idx = 0; idx < ARGCOUNT; idx++) {
char *p = alist_name(&ARGLIST[idx]);
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 726344a42b..1d09e8f6c3 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -2185,7 +2185,7 @@ char *getnextac(int c, void *cookie, int indent, bool do_concat)
}
// repeat until we find an autocommand to execute
- for (;;) {
+ while (true) {
// skip removed commands
while (acp->nextcmd != NULL
&& aucmd_exec_is_deleted(acp->nextcmd->exec)) {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index d1c93733c0..c63ab804af 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -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
forward = true;
buf = curbuf->b_next;
- for (;;) {
+ while (true) {
if (buf == NULL) {
if (!forward) { // tried both directions
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"
// is true, try finding an unlisted buffer.
find_listed = true;
- for (;;) {
+ while (true) {
for (attempt = 0; attempt <= 3; attempt++) {
// may add '^' and '$'
if (toggledollar) {
@@ -3180,7 +3180,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
bool dontwrite = bt_dontwrite(curbuf);
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged()
- ? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
+ ? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
(curbuf->b_flags & BF_NOTEDITED) && !dontwrite
? _("[Not edited]") : "",
(curbuf->b_flags & BF_NEW) && !dontwrite
@@ -3609,7 +3609,7 @@ void ex_buffer_all(exarg_T *eap)
if (had_tab > 0) {
goto_tabpage_tp(first_tabpage, true, true);
}
- for (;;) {
+ while (true) {
tpnext = curtab->tp_next;
for (wp = firstwin; wp != NULL; wp = wpnext) {
wpnext = wp->w_next;
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index c808909942..02226f3cc4 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -607,7 +607,7 @@ struct file_buffer {
int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode
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_bin; ///< 'binary'
int b_p_bomb; ///< 'bomb'
diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c
index 89d63a39d5..de56c5c717 100644
--- a/src/nvim/bufwrite.c
+++ b/src/nvim/bufwrite.c
@@ -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,
- 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)
{
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 write_undo_file = false;
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
return FAIL;
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 6fd32d9113..1d6869990e 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -950,7 +950,7 @@ int copy_indent(int size, char *src)
// Add tabs required for indent.
if (!curbuf->b_p_et) {
- for (;;) {
+ while (true) {
tab_pad = tabstop_padding(ind_col,
curbuf->b_p_ts,
curbuf->b_p_vts_array);
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 545002a197..3d4e0abda9 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -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
&& !wp->w_p_bri
&& !cts.cts_has_virt_text) {
- for (;;) {
+ while (true) {
head = 0;
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);
}
} else {
- for (;;) {
+ while (true) {
// A tab gets expanded, depending on the current column
// Other things also take up space.
head = 0;
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index ceeaa65206..6d90b32545 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -351,7 +351,7 @@ void check_cursor_col_win(win_T *win)
{
colnr_T oldcol = win->w_cursor.col;
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));
if (len == 0) {
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 90723372a9..1b1dea0d62 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -126,7 +126,7 @@ void do_debug(char *cmd)
}
// Repeat getting a command and executing it.
- for (;;) {
+ while (true) {
msg_scroll = true;
need_wait_return = false;
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index ea54554c46..980be0282d 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -86,7 +86,7 @@ void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
}
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);
}
}
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index b2efcbac58..f1a3a679be 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -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;
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
// diff block, thus not touching an existing change, create a new diff
// 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_new = 0;
int dir = FORWARD;
- for (;;) {
+ while (true) {
// Repeat until a line is found which is different or the number of
// lines has become zero.
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.
int io_error = false;
TriState ok = kFalse;
- for (;;) {
+ while (true) {
ok = kFalse;
FILE *fd = os_fopen(diffio->dio_orig.din_fname, "w");
@@ -1042,7 +1042,7 @@ static int check_external_diff(diffio_T *diffio)
} else {
char linebuf[LBUFLEN];
- for (;;) {
+ while (true) {
// For normal diff there must be a line that contains
// "1c1". For unified diff "@@ -1 +1 @@".
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.
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
if (vim_fgets(line, LBUFLEN, fd)) {
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 };
bool eof = dio->dio_internal
? 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_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other;
+ const int idx_to = eap->cmdidx == CMD_diffget ? idx_cur : idx_other;