From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AB626A0547; Fri, 14 Feb 2020 17:28:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C8F2BF72; Fri, 14 Feb 2020 17:28:39 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CE906374; Fri, 14 Feb 2020 17:28:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 08:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,441,1574150400"; d="scan'208";a="227652154" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.222.53]) by orsmga008.jf.intel.com with ESMTP; 14 Feb 2020 08:28:34 -0800 From: Ciara Power To: olivier.matz@6wind.com, arybchenko@solarflare.com Cc: dev@dpdk.org, Ciara Power , bruce.richardson@intel.com, stable@dpdk.org Date: Fri, 14 Feb 2020 16:17:25 +0000 Message-Id: <20200214161725.36104-1-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191202091517.17461-1-ciara.power@intel.com> References: <20191202091517.17461-1-ciara.power@intel.com> Subject: [dpdk-dev] [PATCH v2] lib: fix unnecessary double negation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" An equality expression already returns either 0 or 1. There is no need to use double negation for these cases. Fixes: ea672a8b1655 ("mbuf: remove the rte_pktmbuf structure") Fixes: a0fd91cefcc0 ("mempool: rename functions with confusing names") Cc: olivier.matz@6wind.com Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power Acked-by: Olivier Matz Reviewed-by: Ferruh Yigit --- V2: - Rebased onto master - Changed commit subject and description --- lib/librte_mbuf/rte_mbuf.h | 2 +- lib/librte_mempool/rte_mempool.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 219b110b7..6d080527f 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1535,7 +1535,7 @@ static inline int rte_pktmbuf_trim(struct rte_mbuf *m, uint16_t len) static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, 1); - return !!(m->nb_segs == 1); + return m->nb_segs == 1; } /** diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index f81152af9..e588c5d9b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -1653,7 +1653,7 @@ rte_mempool_in_use_count(const struct rte_mempool *mp); static inline int rte_mempool_full(const struct rte_mempool *mp) { - return !!(rte_mempool_avail_count(mp) == mp->size); + return rte_mempool_avail_count(mp) == mp->size; } /** @@ -1672,7 +1672,7 @@ rte_mempool_full(const struct rte_mempool *mp) static inline int rte_mempool_empty(const struct rte_mempool *mp) { - return !!(rte_mempool_avail_count(mp) == 0); + return rte_mempool_avail_count(mp) == 0; } /** -- 2.17.1