diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-04-26 23:23:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 23:23:44 +0200 |
commit | 3b0df1780e2c8526bda5dead18ee7cc45925caba (patch) | |
tree | c8415dc986f1cd3ddf6044b4ec0318a089db3ed7 /src/nvim/diff.c | |
parent | 7d0479c55810af9bf9f115ba69d1419ea81ec41e (diff) | |
download | rneovim-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/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 14 |
1 files changed, 7 insertions, 7 deletions
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; // May give the warning for a changed buffer here, which can trigger the // FileChangedRO autocommand, which may do nasty things and mess |