From 37ac6058809422d9da0a946f5d5a8b1b4927cd11 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 9 Nov 2012 15:24:53 -0500 Subject: [PATCH] use find_if instead of a loop --- termite.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/termite.cc b/termite.cc index 7ae0636..bb88634 100644 --- a/termite.cc +++ b/termite.cc @@ -429,12 +429,10 @@ void move_first(VteTerminal *vte, select_info *select, F is_match) { return; } - for (long i = 0; i < length; i++) { - if (is_match(codepoints[i])) { - vte_terminal_set_cursor_position(vte, i, cursor_row); - update_selection(vte, select); - break; - } + auto iter = std::find_if(codepoints, codepoints + length, is_match); + if (iter != codepoints + length) { + vte_terminal_set_cursor_position(vte, iter - codepoints, cursor_row); + update_selection(vte, select); } g_free(codepoints);