diff options
author | Bryce Harrington <bryce@osg.samsung.com> | 2015-06-19 15:58:01 -0700 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-07-10 00:12:36 -0700 |
commit | c2547c70a739d74f02979a8b590018ad6cb440d8 (patch) | |
tree | 13bbbc6ae270cc8215378c68284e182a2ef5130f | |
parent | ab254f7efe067176d2f2eda672b773b228f78e2d (diff) | |
download | wayland-c2547c70a739d74f02979a8b590018ad6cb440d8.tar.gz |
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>
-rw-r--r-- | tests/array-test.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/array-test.c b/tests/array-test.c index 37b9afd..fe53240 100644 --- a/tests/array-test.c +++ b/tests/array-test.c @@ -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); |