[v3,4/4] test/hash: use array for small amount of memory

Message ID 20190702002724.41400-4-honnappa.nagarahalli@arm.com
State New
Headers show
Series
  • [v3,1/4] test/hash: reset global variable to discard old data
Related show

Commit Message

Honnappa Nagarahalli July 2, 2019, 12:27 a.m.
Variables of size 128B can make use of stack instead of dynamically
allocated memory.

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

---
v3
  - Allocated pos on stack as it is just 128B

v2
  - N/A

 app/test/test_hash_readwrite_lf.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

-- 
2.17.1

Patch

diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c
index 792244fd0..f0d6f42c1 100644
--- a/app/test/test_hash_readwrite_lf.c
+++ b/app/test/test_hash_readwrite_lf.c
@@ -567,16 +567,9 @@  test_rwc_reader(__attribute__((unused)) void *arg)
 	uint32_t read_cnt;
 	uint32_t *keys;
 	uint32_t extra_keys;
-	int32_t *pos;
+	int32_t pos[BULK_LOOKUP_SIZE];
 	void *temp_a[BULK_LOOKUP_SIZE];
 
-	/* Used to identify keys not inserted in the hash table */
-	pos = rte_malloc(NULL, sizeof(uint32_t) * BULK_LOOKUP_SIZE, 0);
-	if (pos == NULL) {
-		printf("RTE_MALLOC failed\n");
-		return -1;
-	}
-
 	if (read_type & READ_FAIL) {
 		keys = tbl_rwc_test_param.keys_absent;
 		read_cnt = tbl_rwc_test_param.count_keys_absent;