#1339 closed bug (fixed (in master))
Flawed logic in flag_next()
Reported by: | Zaxx | Owned by: | |
---|---|---|---|
Milestone: | 3.3.0 | Keywords: | |
Cc: |
Description
Currently, passing an "on" flag to flag_next() returns the same flag, not the next one.
If you want to iterate over "on" flags with flag_next(), you need to start with "flag+1" and not "flag", as it is mentioned in the header: "Returns the next on flag in flags, starting from (but not including) flag."
Change History (4)
comment:1 Changed 9 years ago by Zaxx
comment:2 Changed 9 years ago by d_m
- Status changed from new to pending
The documentation has been changed to fit your suggestion in head.
comment:3 Changed 9 years ago by d_m
- Resolution set to fixed
- Status changed from pending to closed
comment:4 Changed 9 years ago by myshkin
- Milestone changed from Triage to 3.3.0
Note: See
TracTickets for help on using
tickets.
Note: the current code uses calls to the method that are in phase with the implementation of flag_next, as in the following line:
for (flag = of_next(f, FLAG_START); flag != FLAG_END; flag = of_next(f, flag + 1))
The header simply doesn't match the implementation: "Returns the next on flag in flags, starting from (but not including) flag. FLAG_END will be returned when the end of the flag set is reached. Iteration will start at the beginning of the flag set when flag is FLAG_END."
It would be more like: "Returns the next on flag in flags, starting from (and including) flag. FLAG_END will be returned when the end of the flag set is reached. Iteration will start at the beginning of the flag set when flag is FLAG_START."