diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 9 | ||||
-rw-r--r-- | src/nvim/globals.h | 2 | ||||
-rw-r--r-- | src/nvim/misc2.c | 2 | ||||
-rw-r--r-- | src/nvim/regexp_nfa.c | 7 | ||||
-rw-r--r-- | src/nvim/undo.c | 66 | ||||
-rw-r--r-- | src/nvim/version.c | 8 |
6 files changed, 66 insertions, 28 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 4b5844c5bd..59bda9345e 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3446,6 +3446,7 @@ static linenr_T get_address(char_u **ptr, } if (addr_type != ADDR_LINES) { EMSG(_(e_invaddr)); + cmd = NULL; goto error; } if (skip) @@ -3473,6 +3474,7 @@ static linenr_T get_address(char_u **ptr, c = *cmd++; if (addr_type != ADDR_LINES) { EMSG(_(e_invaddr)); + cmd = NULL; goto error; } if (skip) { /* skip "/pat/" */ @@ -3516,6 +3518,7 @@ static linenr_T get_address(char_u **ptr, ++cmd; if (addr_type != ADDR_LINES) { EMSG(_(e_invaddr)); + cmd = NULL; goto error; } if (*cmd == '&') @@ -3587,7 +3590,8 @@ static linenr_T get_address(char_u **ptr, else n = getdigits(&cmd); if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_BUFFERS) - lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n); + lnum = compute_buffer_local_count( + addr_type, lnum, (i == '-') ? -1 * n : n); else if (i == '-') lnum -= n; else @@ -3655,7 +3659,8 @@ static char_u *invalid_range(exarg_T *eap) } break; case ADDR_ARGUMENTS: - if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) { // add 1 if ARGCOUNT is 0 + // add 1 if ARGCOUNT is 0 + if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) { return (char_u *)_(e_invrange); } break; diff --git a/src/nvim/globals.h b/src/nvim/globals.h index d06cf6bfda..52eebebf41 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -1042,7 +1042,7 @@ EXTERN int lcs_space INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); -EXTERN int lcs_conceal INIT(= '-'); +EXTERN int lcs_conceal INIT(= ' '); /* Characters from 'fillchars' option */ EXTERN int fill_stl INIT(= ' '); diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c index c615e0689f..3c0a1414a6 100644 --- a/src/nvim/misc2.c +++ b/src/nvim/misc2.c @@ -470,7 +470,7 @@ void put_time(FILE *fd, time_t time_) { uint8_t buf[8]; time_to_bytes(time_, buf); - fwrite(buf, sizeof(uint8_t), ARRAY_SIZE(buf), fd); + (void)fwrite(buf, sizeof(uint8_t), ARRAY_SIZE(buf), fd); } /// Writes time_t to "buf[8]". diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index fa356da5b9..b96dcc66b3 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1897,9 +1897,10 @@ static int nfa_regpiece(void) return OK; } - // The engine is very inefficient (uses too many states) when the maximum is - // much larger than the minimum. Bail out if we can use the other engine. - if ((nfa_re_flags & RE_AUTO) && maxval > minval + 200) { + // The engine is very inefficient (uses too many states) when the maximum + // is much larger than the minimum and when the maximum is large. Bail out + // if we can use the other engine. + if ((nfa_re_flags & RE_AUTO) && (maxval > minval + 200 || maxval > 500)) { return FAIL; } diff --git a/src/nvim/undo.c b/src/nvim/undo.c index a4396520bb..69ac18ad54 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -275,32 +275,32 @@ int u_savedel(linenr_T lnum, long nlines) nlines == curbuf->b_ml.ml_line_count ? 2 : lnum, FALSE); } -/* - * Return TRUE when undo is allowed. Otherwise give an error message and - * return FALSE. - */ -int undo_allowed(void) +/// Return true when undo is allowed. Otherwise print an error message and +/// return false. +/// +/// @return true if undo is allowed. +bool undo_allowed(void) { /* Don't allow changes when 'modifiable' is off. */ if (!MODIFIABLE(curbuf)) { EMSG(_(e_modifiable)); - return FALSE; + return false; } // In the sandbox it's not allowed to change the text. if (sandbox != 0) { EMSG(_(e_sandbox)); - return FALSE; + return false; } /* Don't allow changes in the buffer while editing the cmdline. The * caller of getcmdline() may get confused. */ if (textlock != 0) { EMSG(_(e_secure)); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -747,7 +747,11 @@ static void u_free_uhp(u_header_T *uhp) xfree(uhp); } -/// Writes the header. +/// Writes the undofile header. +/// +/// @param bi The buffer information +/// @param hash The hash of the buffer contents +// /// @returns false in case of an error. static bool serialize_header(bufinfo_T *bi, char_u *hash) FUNC_ATTR_NONNULL_ALL @@ -801,6 +805,12 @@ static bool serialize_header(bufinfo_T *bi, char_u *hash) return true; } +/// Writes an undo header. +/// +/// @param bi The buffer information +/// @param uhp The undo header to write +// +/// @returns false in case of an error. static bool serialize_uhp(bufinfo_T *bi, u_header_T *uhp) { if (!undo_write_bytes(bi, (uintmax_t)UF_HEADER_MAGIC, 2)) { @@ -921,6 +931,9 @@ static u_header_T *unserialize_uhp(bufinfo_T *bi, /// Serializes "uep". /// +/// @param bi The buffer information +/// @param uep The undo entry to write +// /// @returns false in case of an error. static bool serialize_uep(bufinfo_T *bi, u_entry_T *uep) { @@ -1545,6 +1558,10 @@ theend: /// Writes a sequence of bytes to the undo file. /// +/// @param bi The buffer info +/// @param ptr The byte buffer to write +/// @param len The number of bytes to write +/// /// @returns false in case of an error. static bool undo_write(bufinfo_T *bi, uint8_t *ptr, size_t len) FUNC_ATTR_NONNULL_ARG(1) @@ -1556,6 +1573,10 @@ static bool undo_write(bufinfo_T *bi, uint8_t *ptr, size_t len) /// /// Must match with undo_read_?c() functions. /// +/// @param bi The buffer info +/// @param nr The number to write +/// @param len The number of bytes to use when writing the number. +/// /// @returns false in case of an error. static bool undo_write_bytes(bufinfo_T *bi, uintmax_t nr, size_t len) { @@ -1600,6 +1621,10 @@ static time_t undo_read_time(bufinfo_T *bi) /// Reads "buffer[size]" from the undo file. /// +/// @param bi The buffer info +/// @param buffer Character buffer to read data into +/// @param size The size of the character buffer +/// /// @returns false in case of an error. static bool undo_read(bufinfo_T *bi, uint8_t *buffer, size_t size) FUNC_ATTR_NONNULL_ARG(1) @@ -2830,19 +2855,26 @@ static char_u *u_save_line(linenr_T lnum) return vim_strsave(ml_get(lnum)); } -/* - * Check if the 'modified' flag is set, or 'ff' has changed (only need to - * check the first character, because it can only be "dos", "unix" or "mac"). - * "nofile" and "scratch" type buffers are considered to always be unchanged. - */ -int bufIsChanged(buf_T *buf) +/// Check if the 'modified' flag is set, or 'ff' has changed (only need to +/// check the first character, because it can only be "dos", "unix" or "mac"). +/// "nofile" and "scratch" type buffers are considered to always be unchanged. +/// +/// @param buf The buffer to check +/// +/// @return true if the buffer has changed +bool bufIsChanged(buf_T *buf) { return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true)); } -int curbufIsChanged(void) +/// Check if the 'modified' flag is set, or 'ff' has changed (only need to +/// check the first character, because it can only be "dos", "unix" or "mac"). +/// "nofile" and "scratch" type buffers are considered to always be unchanged. +/// +/// @return true if the current buffer has changed +bool curbufIsChanged(void) { return !bt_dontwrite(curbuf) && diff --git a/src/nvim/version.c b/src/nvim/version.c index d5bbd734f4..83a47c207d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -347,7 +347,7 @@ static int included_patches[] = { // 652 NA 651, // 650 NA - // 649, + 649, // 648 NA // 647 NA 646, @@ -365,7 +365,7 @@ static int included_patches[] = { // 634, 633, // 632 NA - // 631, + 631, 630, 629, // 628, @@ -373,13 +373,13 @@ static int included_patches[] = { // 626 NA // 625 NA // 624, - // 623, + 623, // 622 NA // 621 NA // 620, // 619 NA // 618 NA - // 617, + 617, // 616, 615, // 614, |