From ff06d173de8cf6ae34ad7548d95c6cbc513fbc47 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Tue, 6 Dec 2016 09:58:11 +0000
Subject: [PATCH] (edit.c) Cleanup unsafe-loop-optimizations compiler warning
Found by GCC 6.2.0.
edit.c: In function 'right_of_four_spaces':
edit.c:1367:5: error: cannot optimize possibly infinite loops [-Werror=unsafe-loop-optimizations]
edit.c: In function 'edit_backspace':
edit.c:2682:5: error: cannot optimize possibly infinite loops [-Werror=unsafe-loop-optimizations]
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/editor/edit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/editor/edit.c b/src/editor/edit.c
index 56ef4b5..1b55c5c 100644
a
|
b
|
right_of_four_spaces (WEdit * edit) |
1364 | 1364 | { |
1365 | 1365 | int i, ch = 0; |
1366 | 1366 | |
1367 | | for (i = 1; i <= HALF_TAB_SIZE; i++) |
| 1367 | for (i = HALF_TAB_SIZE; i > 0; i--) |
1368 | 1368 | ch |= edit_buffer_get_byte (&edit->buffer, edit->buffer.curs1 - i); |
1369 | 1369 | |
1370 | 1370 | return (ch == ' ' && is_aligned_on_a_tab (edit)); |
… |
… |
edit_backspace (WEdit * edit, gboolean byte_delete) |
2678 | 2678 | (void) byte_delete; |
2679 | 2679 | #endif |
2680 | 2680 | |
2681 | | for (i = 1; i <= char_length; i++) |
| 2681 | for (i = char_length; i > 0; i--) |
2682 | 2682 | { |
2683 | 2683 | if (edit->mark1 >= edit->buffer.curs1) |
2684 | 2684 | { |