aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-12 15:54:54 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-13 23:39:56 +0100
commit28f4f3c48498086307ed825d1761edb5789ca0e8 (patch)
tree880d2104092261fe0457b17a9ddda8a6e0f7f2ed /src/nvim/strings.c
parent48bcc7b9710d6db619b05254ea87f4087cdd9764 (diff)
downloadrneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.gz
rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.bz2
rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.zip
refactor: follow style guide
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r--src/nvim/strings.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 007d088bbb..eb851a4c1b 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -485,10 +485,8 @@ void sort_strings(char **files, int count)
bool has_non_ascii(const char *s)
FUNC_ATTR_PURE
{
- const char *p;
-
if (s != NULL) {
- for (p = s; *p != NUL; p++) {
+ for (const char *p = s; *p != NUL; p++) {
if ((uint8_t)(*p) >= 128) {
return true;
}
@@ -1964,7 +1962,6 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
assert(str_arg_l < sizeof(tmp));
if (remove_trailing_zeroes) {
- int i;
char *tp;
// using %g or %G: remove superfluous zeroes
@@ -1979,7 +1976,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
STRMOVE(tp + 1, tp + 2);
str_arg_l--;
}
- i = (tp[1] == '-') ? 2 : 1;
+ int i = (tp[1] == '-') ? 2 : 1;
while (tp[i] == '0') {
// change "1.0e07" to "1.0e7"
STRMOVE(tp + i, tp + i + 1);