lib: fix unnecessary boolean casts
Checks
Commit Message
The values already boolean types, so the use of !! is unnecessary as
it is used to convert to boolean.
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>
---
lib/librte_mbuf/rte_mbuf.h | 2 +-
lib/librte_mempool/rte_mempool.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On 12/2/2019 9:15 AM, Ciara Power wrote:
> The values already boolean types, so the use of !! is unnecessary as
> it is used to convert to boolean.
>
> 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>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
On Mon, Dec 02, 2019 at 09:15:17AM +0000, Ciara Power wrote:
> The values already boolean types, so the use of !! is unnecessary as
> it is used to convert to boolean.
>
> 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>
Thanks
@@ -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;
}
/**
@@ -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;
}
/**