[hackers] [libgrapheme] Fix bidi purge loop logic a bit || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Tue, 29 Nov 2022 23:45:58 +0100 (CET)

commit 46914b2879a8e9efa799176964479adfbab01bfa
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Tue Nov 29 23:45:10 2022 +0100
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Nov 29 23:45:10 2022 +0100

    Fix bidi purge loop logic a bit
    
    Otherwise you could skip one element by accident. This does not have
    direct consequences, but may lead to slightly wrong behaviour when
    there are stray opening brackets.
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>

diff --git a/src/bidirectional.c b/src/bidirectional.c
index 90aa423..c4a5057 100644
--- a/src/bidirectional.c
+++ b/src/bidirectional.c
_AT_@ -636,8 +636,9 @@ preprocess_bracket_pairs(uint_least32_t *buf, size_t buflen, size_t off,
 
                                         /* remove all uncompleted FIFO elements
                                          * above i - 1 */
- for (j = i; j < fifo_len; j++) {
+ for (j = i; j < fifo_len;) {
                                                 if (fifo[j].complete) {
+ j++;
                                                         continue;
                                                 }
 
Received on Tue Nov 29 2022 - 23:45:58 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 29 2022 - 23:48:30 CET