mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-23 05:01:40 +01:00
Swap conditions for ARRAY_FOR_EACH()
The current conditions result in _elem being assigned _arr[i] before the condition is checked. This is fine since we then break from the loop and don't access it anyway, but it makes Coverity unhappy. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7b66f16c2a
commit
bd8e308693
1 changed files with 1 additions and 1 deletions
|
|
@ -76,7 +76,7 @@ int list_empty(const struct list *list);
|
|||
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
||||
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
|
||||
#define ARRAY_FOR_EACH(_arr, _elem) \
|
||||
for (size_t _i = 0; (_elem = &_arr[_i]) && _i < ARRAY_LENGTH(_arr); _i++)
|
||||
for (size_t _i = 0; _i < ARRAY_LENGTH(_arr) && (_elem = &_arr[_i]); _i++)
|
||||
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue