test/hash: use array for small amount of memory
authorHonnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Tue, 2 Jul 2019 00:27:24 +0000 (19:27 -0500)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 5 Jul 2019 08:45:17 +0000 (10:45 +0200)
Variables of size 128B can make use of stack instead of dynamically
allocated memory.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
app/test/test_hash_readwrite_lf.c

index dc4a52d..1f2fba4 100644 (file)
@@ -565,16 +565,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;