From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by dpdk.org (Postfix) with ESMTP id 0EED6B4BD for ; Sat, 14 Feb 2015 15:59:28 +0100 (CET) Received: by iebtr6 with SMTP id tr6so15143172ieb.10 for ; Sat, 14 Feb 2015 06:59:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Fz6wOhp2BxLau9W5xirSfRkWJN7dbuIcCcGZ0iWjj+c=; b=elOBt19MzHEBg+D5a1el0sJGVWAYPlV5s+wUFGytZ0Q8at4FY2XBJiHq6fBat/kS7U AERtIBxicXdSx4GfmcBD4TmA44TH3CeVLUSdJedEwhM7IkQqBuemxobLNaU8WStARvKw 00QvaBIpUo+HyvXzzjZHXDJGfn0VgxFb3NmSqocI56F2NQliSqAPsMHB7eEm3koAB0By 4j8KKHhAsffas4Y76PjURaS+OIKFUon5rV5aMzZQiswVoiHiEfna0pkysPxoj8G3AqyQ nbmkrP2DkQXVo8hx2b/1PsRSVm4uncMOlOUKtxe9jn8CHO8sr72VjtK0XiwIDLK2u2Nd gDAg== X-Gm-Message-State: ALoCoQkYZLpBArIGO/39h9ASegFatZxqpydBu+TSaYoiH1D6yqRXuHhW4WlR/1Gdicrwg8SBBb9V X-Received: by 10.42.111.5 with SMTP id s5mr20285457icp.79.1423925967461; Sat, 14 Feb 2015 06:59:27 -0800 (PST) Received: from uryu.home.lan ([67.210.173.2]) by mx.google.com with ESMTPSA id a125sm6302383ioa.40.2015.02.14.06.59.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 14 Feb 2015 06:59:26 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: dev@dpdk.org Date: Sat, 14 Feb 2015 09:59:05 -0500 Message-Id: <1423925950-5201-1-git-send-email-shemming@brocade.com> X-Mailer: git-send-email 2.1.4 Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 1/6] test: remove unneeded casts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2015 14:59:28 -0000 The malloc family returns void * and therefore cast is unnecessary. Use calloc rather than zmalloc with multiply for array. Signed-off-by: Stephen Hemminger --- app/test/test_hash_perf.c | 8 ++++---- app/test/test_mempool.c | 2 +- app/test/test_ring.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c index be34957..6f719fc 100644 --- a/app/test/test_hash_perf.c +++ b/app/test/test_hash_perf.c @@ -459,13 +459,13 @@ run_single_tbl_perf_test(const struct rte_hash *h, hash_operation func, /* Initialise */ num_buckets = params->entries / params->bucket_entries; - key = (uint8_t *) rte_zmalloc("hash key", - params->key_len * sizeof(uint8_t), 16); + key = rte_zmalloc("hash key", + params->key_len * sizeof(uint8_t), 16); if (key == NULL) return -1; - bucket_occupancies = (uint32_t *) rte_zmalloc("bucket occupancies", - num_buckets * sizeof(uint32_t), 16); + bucket_occupancies = rte_calloc("bucket occupancies", + num_buckets, sizeof(uint32_t), 16); if (bucket_occupancies == NULL) { rte_free(key); return -1; diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index 303d2b3..de85c9c 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -360,7 +360,7 @@ test_mempool_basic_ex(struct rte_mempool * mp) if (mp == NULL) return ret; - obj = (void **)rte_zmalloc("test_mempool_basic_ex", (MEMPOOL_SIZE * sizeof(void *)), 0); + obj = rte_calloc("test_mempool_basic_ex", MEMPOOL_SIZE , sizeof(void *), 0); if (obj == NULL) { printf("test_mempool_basic_ex fail to rte_malloc\n"); return ret; diff --git a/app/test/test_ring.c b/app/test/test_ring.c index 2cd8e77..ce25329 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -1259,7 +1259,7 @@ test_ring_basic_ex(void) struct rte_ring * rp; void **obj = NULL; - obj = (void **)rte_zmalloc("test_ring_basic_ex_malloc", (RING_SIZE * sizeof(void *)), 0); + obj = rte_calloc("test_ring_basic_ex_malloc", RING_SIZE, sizeof(void *), 0); if (obj == NULL) { printf("test_ring_basic_ex fail to rte_malloc\n"); goto fail_test; -- 2.1.4