[v5,8/8] test/ring: user uintptr_t instead of unsigned long

Message ID 20201025054556.14277-9-honnappa.nagarahalli@arm.com
State New
Headers show
Series
  • lib/ring: add zero copy APIs
Related show

Commit Message

Honnappa Nagarahalli Oct. 25, 2020, 5:45 a.m.
Use uintptr_t instead of unsigned long while initializing the
array of pointers.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

---
 app/test/test_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

Ananyev, Konstantin Oct. 27, 2020, 2:14 p.m. | #1
> Use uintptr_t instead of unsigned long while initializing the

> array of pointers.

> 

> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---

>  app/test/test_ring.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/app/test/test_ring.c b/app/test/test_ring.c

> index 3914cb98a..5b7fdfa45 100644

> --- a/app/test/test_ring.c

> +++ b/app/test/test_ring.c

> @@ -447,7 +447,7 @@ test_ring_mem_init(void *obj, unsigned int count, int esize)

>  	/* Legacy queue APIs? */

>  	if (esize == -1)

>  		for (i = 0; i < count; i++)

> -			((void **)obj)[i] = (void *)(unsigned long)i;

> +			((void **)obj)[i] = (void *)(uintptr_t)i;

>  	else

>  		for (i = 0; i < (count * esize / sizeof(uint32_t)); i++)

>  			((uint32_t *)obj)[i] = i;

> --


Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>


> 2.17.1

Patch

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index 3914cb98a..5b7fdfa45 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -447,7 +447,7 @@  test_ring_mem_init(void *obj, unsigned int count, int esize)
 	/* Legacy queue APIs? */
 	if (esize == -1)
 		for (i = 0; i < count; i++)
-			((void **)obj)[i] = (void *)(unsigned long)i;
+			((void **)obj)[i] = (void *)(uintptr_t)i;
 	else
 		for (i = 0; i < (count * esize / sizeof(uint32_t)); i++)
 			((uint32_t *)obj)[i] = i;