mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
tests: Don't increment variables inside an assert()
Addresses this warning found by Denis Denisov: [tests/array-test.c:137]: (warning) Assert statement modifies 'i'. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
This commit is contained in:
parent
ab254f7efe
commit
c2547c70a7
1 changed files with 6 additions and 3 deletions
|
|
@ -126,7 +126,8 @@ TEST(array_for_each)
|
|||
{
|
||||
static const int elements[] = { 77, 12, 45192, 53280, 334455 };
|
||||
struct wl_array array;
|
||||
int *p, i;
|
||||
int *p;
|
||||
int i;
|
||||
|
||||
wl_array_init(&array);
|
||||
for (i = 0; i < 5; i++) {
|
||||
|
|
@ -136,8 +137,10 @@ TEST(array_for_each)
|
|||
}
|
||||
|
||||
i = 0;
|
||||
wl_array_for_each(p, &array)
|
||||
assert(*p == elements[i++]);
|
||||
wl_array_for_each(p, &array) {
|
||||
assert(*p == elements[i]);
|
||||
i++;
|
||||
}
|
||||
assert(i == 5);
|
||||
|
||||
wl_array_release(&array);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue