[v2] lib: fix unnecessary double negation

Message ID 20200214161725.36104-1-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] lib: fix unnecessary double negation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail apply issues

Commit Message

Power, Ciara Feb. 14, 2020, 4:17 p.m. UTC
  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 <ciara.power@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

---
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(-)
  

Comments

David Marchand Feb. 14, 2020, 4:39 p.m. UTC | #1
On Fri, Feb 14, 2020 at 5:28 PM Ciara Power <ciara.power@intel.com> wrote:
>
> 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: stable@dpdk.org
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks.


--
David Marchand
  

Patch

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;
 }
 
 /**