Skip to content

Commit

Permalink
lib: fix unnecessary double negation
Browse files Browse the repository at this point in the history
[ upstream commit f42c9ac ]

An equality expression already returns either 0 or 1.
There is no need to use double negation for these cases.

Fixes: ea672a8 ("mbuf: remove the rte_pktmbuf structure")
Fixes: a0fd91c ("mempool: rename functions with confusing names")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
  • Loading branch information
ciarapow authored and kevintraynor committed Feb 19, 2020
1 parent 10fdbbc commit 368b63c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/librte_mbuf/rte_mbuf.h
Expand Up @@ -2092,7 +2092,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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/librte_mempool/rte_mempool.h
Expand Up @@ -1573,7 +1573,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;
}

/**
Expand All @@ -1592,7 +1592,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;
}

/**
Expand Down

0 comments on commit 368b63c

Please sign in to comment.