From fb17929fabaa5184c183dac482cee1285f949e72 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 9 Jun 2019 10:41:14 +0200 Subject: [PATCH] tweaks: use FALSE for booleans instead of zero Also adjust some indentation and reduce the scope of a variable. --- src/chars.c | 8 ++++---- src/color.c | 4 +--- src/cut.c | 4 ++-- src/search.c | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/chars.c b/src/chars.c index 2636a0b5..b35147b6 100644 --- a/src/chars.c +++ b/src/chars.c @@ -70,7 +70,7 @@ bool is_alpha_mbchar(const char *c) wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) - return 0; + return FALSE; return iswalpha(wc); } else @@ -86,7 +86,7 @@ bool is_alnum_mbchar(const char *c) wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) - return 0; + return FALSE; return iswalnum(wc); } else @@ -102,7 +102,7 @@ bool is_blank_mbchar(const char *c) wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) - return 0; + return FALSE; return iswblank(wc); } else @@ -139,7 +139,7 @@ bool is_punct_mbchar(const char *c) wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) - return 0; + return FALSE; return iswpunct(wc); } else diff --git a/src/color.c b/src/color.c index 3631f6d0..0a0ad94c 100644 --- a/src/color.c +++ b/src/color.c @@ -331,12 +331,10 @@ void check_the_multis(linestruct *line) /* Allocate (for one line) the cache space for multiline color regexes. */ void alloc_multidata_if_needed(linestruct *fileptr) { - int i; - if (fileptr->multidata == NULL) { fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short)); - for (i = 0; i < openfile->syntax->nmultis; i++) + for (int i = 0; i < openfile->syntax->nmultis; i++) fileptr->multidata[i] = -1; } } diff --git a/src/cut.c b/src/cut.c index 1dee4b10..6417a859 100644 --- a/src/cut.c +++ b/src/cut.c @@ -341,9 +341,9 @@ void do_cut_text(bool copying, bool marked, bool until_eof, bool append) if (using_magicline) UNSET(NO_NEWLINES); } else -#endif /* !NANO_TINY */ +#endif + set_modified(); - set_modified(); refresh_needed = TRUE; } diff --git a/src/search.c b/src/search.c index 4bd6236c..4b2e2a16 100644 --- a/src/search.c +++ b/src/search.c @@ -841,7 +841,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, void do_gotolinecolumn_void(void) { do_gotolinecolumn(openfile->current->lineno, - openfile->placewewant + 1, FALSE, TRUE); + openfile->placewewant + 1, FALSE, TRUE); } #ifndef NANO_TINY @@ -943,7 +943,7 @@ void do_find_bracket(void) while (charcount-- > 0) { if (reverse) wanted_ch = matchbrackets + move_mbleft(matchbrackets, - wanted_ch - matchbrackets); + wanted_ch - matchbrackets); else wanted_ch += move_mbright(wanted_ch, 0); }