nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 18eb7e6d217f1562b8e11c090781f255c61e6bab
parent e84a790b5d0b2a033d74222cd140671adc220620
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 27 Apr 2019 17:10:10 +0200

tweaks: elide an unneeded 'if' and 'break'

Diffstat:
Msrc/search.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -973,8 +973,7 @@ void do_find_bracket(void) strncpy(bracket_pair + ch_len, wanted_ch, wanted_ch_len); bracket_pair[ch_len + wanted_ch_len] = '\0'; - while (TRUE) { - if (find_a_bracket(reverse, bracket_pair)) { + while (find_a_bracket(reverse, bracket_pair)) { /* If we found an identical bracket, increment balance. If we * found a complementary bracket, decrement it. */ balance += (strncmp(openfile->current->data + openfile->current_x, @@ -984,16 +983,13 @@ void do_find_bracket(void) * the screen and get out. */ if (balance == 0) { edit_redraw(was_current, FLOWING); - break; + return; } - } else { + } /* We didn't find either an opening or closing bracket. * Indicate this, restore where we were, and get out. */ statusbar(_("No matching bracket")); openfile->current = was_current; openfile->current_x = was_current_x; - break; - } - } } #endif /* !NANO_TINY */