diff mbox

[27/29] tests/hbitmap: use ARRAY_SIZE macro

Message ID 20170718061005.29518-28-f4bug@amsat.org
State New
Headers show

Commit Message

Philippe Mathieu-Daudé July 18, 2017, 6:10 a.m. UTC
Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/test-hbitmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Marc-André Lureau July 18, 2017, 10:52 a.m. UTC | #1
On Mon, Jul 17, 2017 at 11:10 PM, Philippe Mathieu-Daudé
<f4bug@amsat.org> wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  tests/test-hbitmap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
> index 1acb353889..628e72122b 100644
> --- a/tests/test-hbitmap.c
> +++ b/tests/test-hbitmap.c
> @@ -813,7 +813,7 @@ static void test_hbitmap_serialize_basic(TestHBitmapData *data,
>      size_t buf_size;
>      uint8_t *buf;
>      uint64_t positions[] = { 0, 1, L1 - 1, L1, L2 - 1, L2, L2 + 1, L3 - 1 };
> -    int num_positions = sizeof(positions) / sizeof(positions[0]);
> +    int num_positions = ARRAY_SIZE(positions);
>
>      hbitmap_test_init(data, L3, 0);
>      g_assert(hbitmap_is_serializable(data->hb));
> @@ -838,7 +838,7 @@ static void test_hbitmap_serialize_part(TestHBitmapData *data,
>      size_t buf_size;
>      uint8_t *buf;
>      uint64_t positions[] = { 0, 1, L1 - 1, L1, L2 - 1, L2, L2 + 1, L3 - 1 };
> -    int num_positions = sizeof(positions) / sizeof(positions[0]);
> +    int num_positions = ARRAY_SIZE(positions);
>
>      hbitmap_test_init(data, L3, 0);
>      buf_size = L2;
> @@ -880,7 +880,7 @@ static void test_hbitmap_serialize_zeroes(TestHBitmapData *data,
>      int64_t next;
>      uint64_t min_l1 = MAX(L1, 64);
>      uint64_t positions[] = { 0, min_l1, L2, L3 - min_l1};
> -    int num_positions = sizeof(positions) / sizeof(positions[0]);
> +    int num_positions = ARRAY_SIZE(positions);
>
>      hbitmap_test_init(data, L3, 0);
>
> --
> 2.13.2
>
>
John Snow July 18, 2017, 3:36 p.m. UTC | #2
On 07/18/2017 02:10 AM, Philippe Mathieu-Daudé wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: John Snow <jsnow@redhat.com>
diff mbox

Patch

diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
index 1acb353889..628e72122b 100644
--- a/tests/test-hbitmap.c
+++ b/tests/test-hbitmap.c
@@ -813,7 +813,7 @@  static void test_hbitmap_serialize_basic(TestHBitmapData *data,
     size_t buf_size;
     uint8_t *buf;
     uint64_t positions[] = { 0, 1, L1 - 1, L1, L2 - 1, L2, L2 + 1, L3 - 1 };
-    int num_positions = sizeof(positions) / sizeof(positions[0]);
+    int num_positions = ARRAY_SIZE(positions);
 
     hbitmap_test_init(data, L3, 0);
     g_assert(hbitmap_is_serializable(data->hb));
@@ -838,7 +838,7 @@  static void test_hbitmap_serialize_part(TestHBitmapData *data,
     size_t buf_size;
     uint8_t *buf;
     uint64_t positions[] = { 0, 1, L1 - 1, L1, L2 - 1, L2, L2 + 1, L3 - 1 };
-    int num_positions = sizeof(positions) / sizeof(positions[0]);
+    int num_positions = ARRAY_SIZE(positions);
 
     hbitmap_test_init(data, L3, 0);
     buf_size = L2;
@@ -880,7 +880,7 @@  static void test_hbitmap_serialize_zeroes(TestHBitmapData *data,
     int64_t next;
     uint64_t min_l1 = MAX(L1, 64);
     uint64_t positions[] = { 0, min_l1, L2, L3 - min_l1};
-    int num_positions = sizeof(positions) / sizeof(positions[0]);
+    int num_positions = ARRAY_SIZE(positions);
 
     hbitmap_test_init(data, L3, 0);