nnn

mirror of https://github.com/jarun/nnn
Log | Files | Refs | README | LICENSE

commit 08ac4b75e911c9c1f321290597d790e15d0c686f
parent 86f12b0d72fc4dd69b74352f0f76d652a5f357ce
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sat, 31 Jan 2026 02:00:33 +0530

Fix Code scanning alert: For loop variable changed in body #96

Diffstat:
Msrc/nnn.c | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -3328,15 +3328,14 @@ static int fill(const char *fltr, regex_t *re) fltrexp_t fltrexp = { .regex = re, .str = fltr }; #endif - for (int count = 0; count < ndents; ++count) { + int count = 0; + + while (count < ndents) { if (filterfn(&fltrexp, pdents[count].name) == 0) { - if (count != --ndents) { + if (count != --ndents) swap_ent(count, ndents); - --count; - } - - continue; - } + } else + ++count; } return ndents;