[vte] ring: Silence -Wunsafe-loop-optimizations



commit 513220cd80272947ccdcb6b13d7b48ba9bd1d601
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 14 12:36:38 2018 +0100

    ring: Silence -Wunsafe-loop-optimizations
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789778

 src/ring.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/ring.cc b/src/ring.cc
index 05e938e..2db4b0e 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -244,7 +244,8 @@ _vte_ring_get_hyperlink_idx_no_update_current (VteRing *ring, const char *hyperl
         len = strlen(hyperlink);
 
         /* Linear search for this particular URI */
-        for (idx = 1; idx <= ring->hyperlink_highest_used_idx; idx++) {
+        auto const last_idx = ring->hyperlink_highest_used_idx + 1;
+        for (idx = 1; idx < last_idx; idx++) {
                 if (strcmp(hyperlink_get(ring, idx)->str, hyperlink) == 0) {
                         _vte_debug_print (VTE_DEBUG_HYPERLINK,
                                           "get_hyperlink_idx: already existing idx %d for id;uri=\"%s\"\n",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]