diff mbox series

[API-NEXT,v4,4/8] validation: pool: initialize params correctly

Message ID 1509091212-14398-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v4,1/8] api: pool: relax packet pool param num | expand

Commit Message

Github ODP bot Oct. 27, 2017, 8 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Use odp_pool_param_init() to initialize pool parameters.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 234 (psavol:next-pool-param)
 ** https://github.com/Linaro/odp/pull/234
 ** Patch: https://github.com/Linaro/odp/pull/234.patch
 ** Base sha: d61d32590d1772b70b8dcd0d0ec44d29029d7443
 ** Merge commit sha: 436021e0a0bff8bda38fa420ebbc4545c97a7fc8
 **/
 test/validation/api/pool/pool.c | 87 ++++++++++++++++++++---------------------
 1 file changed, 43 insertions(+), 44 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index c38a336ce..461715cc9 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -16,11 +16,11 @@ 
 static const int default_buffer_size = 1500;
 static const int default_buffer_num = 1000;
 
-static void pool_create_destroy(odp_pool_param_t *params)
+static void pool_create_destroy(odp_pool_param_t *param)
 {
 	odp_pool_t pool;
 
-	pool = odp_pool_create(NULL, params);
+	pool = odp_pool_create(NULL, param);
 	CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
 	CU_ASSERT(odp_pool_to_u64(pool) !=
 		  odp_pool_to_u64(ODP_POOL_INVALID));
@@ -29,42 +29,41 @@  static void pool_create_destroy(odp_pool_param_t *params)
 
 void pool_test_create_destroy_buffer(void)
 {
-	odp_pool_param_t params = {
-			.buf = {
-				.size  = default_buffer_size,
-				.align = ODP_CACHE_LINE_SIZE,
-				.num   = default_buffer_num,
-			},
-			.type = ODP_POOL_BUFFER,
-	};
-
-	pool_create_destroy(&params);
+	odp_pool_param_t param;
+
+	odp_pool_param_init(&param);
+
+	param.type      = ODP_POOL_BUFFER,
+	param.buf.size  = default_buffer_size;
+	param.buf.align = ODP_CACHE_LINE_SIZE;
+	param.buf.num   = default_buffer_num;
+
+	pool_create_destroy(&param);
 }
 
 void pool_test_create_destroy_packet(void)
 {
-	odp_pool_param_t params = {
-			.pkt = {
-				.seg_len = 0,
-				.len = default_buffer_size,
-				.num   = default_buffer_num,
-			},
-			.type = ODP_POOL_PACKET,
-	};
-
-	pool_create_destroy(&params);
+	odp_pool_param_t param;
+
+	odp_pool_param_init(&param);
+
+	param.type    = ODP_POOL_PACKET;
+	param.pkt.len = default_buffer_size;
+	param.pkt.num = default_buffer_num;
+
+	pool_create_destroy(&param);
 }
 
 void pool_test_create_destroy_timeout(void)
 {
-	odp_pool_param_t params = {
-			.tmo = {
-				.num   = default_buffer_num,
-			},
-			.type = ODP_POOL_TIMEOUT,
-	};
-
-	pool_create_destroy(&params);
+	odp_pool_param_t param;
+
+	odp_pool_param_init(&param);
+
+	param.type    = ODP_POOL_TIMEOUT;
+	param.tmo.num = default_buffer_num;
+
+	pool_create_destroy(&param);
 }
 
 void pool_test_lookup_info_print(void)
@@ -72,16 +71,16 @@  void pool_test_lookup_info_print(void)
 	odp_pool_t pool;
 	const char pool_name[] = "pool_for_lookup_test";
 	odp_pool_info_t info;
-	odp_pool_param_t params = {
-			.buf = {
-				.size  = default_buffer_size,
-				.align = ODP_CACHE_LINE_SIZE,
-				.num  = default_buffer_num,
-			},
-			.type  = ODP_POOL_BUFFER,
-	};
-
-	pool = odp_pool_create(pool_name, &params);
+	odp_pool_param_t param;
+
+	odp_pool_param_init(&param);
+
+	param.type      = ODP_POOL_BUFFER;
+	param.buf.size  = default_buffer_size;
+	param.buf.align = ODP_CACHE_LINE_SIZE;
+	param.buf.num   = default_buffer_num;
+
+	pool = odp_pool_create(pool_name, &param);
 	CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
 
 	pool = odp_pool_lookup(pool_name);
@@ -89,10 +88,10 @@  void pool_test_lookup_info_print(void)
 
 	CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0);
 	CU_ASSERT(strncmp(pool_name, info.name, sizeof(pool_name)) == 0);
-	CU_ASSERT(params.buf.size <= info.params.buf.size);
-	CU_ASSERT(params.buf.align <= info.params.buf.align);
-	CU_ASSERT(params.buf.num <= info.params.buf.num);
-	CU_ASSERT(params.type == info.params.type);
+	CU_ASSERT(param.buf.size <= info.params.buf.size);
+	CU_ASSERT(param.buf.align <= info.params.buf.align);
+	CU_ASSERT(param.buf.num <= info.params.buf.num);
+	CU_ASSERT(param.type == info.params.type);
 
 	odp_pool_print(pool);