refactor: change pre-decrement/increment to post (#19799)

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
Lewis Russell
2022-08-16 12:26:08 +01:00
committed by GitHub
parent 9a4b8dc603
commit 542fa8a9cc
32 changed files with 351 additions and 360 deletions

View File

@@ -632,7 +632,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
}
if (aborting()) { // autocmds may abort script processing
--no_wait_return;
no_wait_return--;
msg_scroll = msg_save;
curbuf->b_p_ro = TRUE; // must use "w!" now
return FAIL;
@@ -1197,11 +1197,11 @@ retry:
}
// Deal with a bad byte and continue with the next.
++fromp;
--from_size;
fromp++;
from_size--;
if (bad_char_behavior == BAD_KEEP) {
*top++ = *(fromp - 1);
--to_size;
to_size--;
} else if (bad_char_behavior != BAD_DROP) {
*top++ = (char)bad_char_behavior;
to_size--;
@@ -1239,7 +1239,7 @@ retry:
// Check for a trailing incomplete UTF-8 sequence
tail = ptr + size - 1;
while (tail > ptr && (*tail & 0xc0) == 0x80) {
--tail;
tail--;
}
if (tail + utf_byte2len(*tail) <= ptr + size) {
tail = NULL;
@@ -1557,7 +1557,7 @@ rewind_retry:
* Keep it fast!
*/
if (fileformat == EOL_MAC) {
--ptr;
ptr--;
while (++ptr, --size >= 0) {
// catch most common case first
if ((c = *ptr) != NUL && c != CAR && c != NL) {
@@ -1578,20 +1578,20 @@ rewind_retry:
if (read_undo_file) {
sha256_update(&sha_ctx, (char_u *)line_start, (size_t)len);
}
++lnum;
lnum++;
if (--read_count == 0) {
error = true; // break loop
line_start = ptr; // nothing left to write
break;
}
} else {
--skip_count;
skip_count--;
}
line_start = ptr + 1;
}
}
} else {
--ptr;
ptr--;
while (++ptr, --size >= 0) {
if ((c = *ptr) != NUL && c != NL) { // catch most common case
continue;
@@ -1634,14 +1634,14 @@ rewind_retry:
if (read_undo_file) {
sha256_update(&sha_ctx, (char_u *)line_start, (size_t)len);
}
++lnum;
lnum++;
if (--read_count == 0) {
error = true; // break loop
line_start = ptr; // nothing left to write
break;
}
} else {
--skip_count;
skip_count--;
}
line_start = ptr + 1;
}
@@ -2000,7 +2000,7 @@ static linenr_T readfile_linenr(linenr_T linecnt, char_u *p, char_u *endp)
lnum = curbuf->b_ml.ml_line_count - linecnt + 1;
for (s = p; s < endp; ++s) {
if (*s == '\n') {
++lnum;
lnum++;
}
}
return lnum;
@@ -2478,7 +2478,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
} else { // less lines
end -= old_line_count - buf->b_ml.ml_line_count;
if (end < start) {
--no_wait_return;
no_wait_return--;
msg_scroll = msg_save;
emsg(_("E204: Autocommand changed number of lines in unexpected way"));
return FAIL;
@@ -4820,8 +4820,8 @@ int check_timestamps(int focus)
}
}
}
--no_wait_return;
need_check_timestamps = FALSE;
no_wait_return--;
need_check_timestamps = false;
if (need_wait_return && didit == 2) {
// make sure msg isn't overwritten
msg_puts("\n");
@@ -5681,7 +5681,7 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs
reg_pat[i++] = '.';
reg_pat[i++] = '*';
while (p[1] == '*') { // "**" matches like "*"
++p;
p++;
}
break;
case '.':
@@ -5769,7 +5769,7 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs
case '}':
reg_pat[i++] = '\\';
reg_pat[i++] = ')';
--nested;
nested--;
break;
case ',':
if (nested) {