[dpdk-dev] mbuf: remove void pointer cast
Checks
Commit Message
It is unnecessary to cast from void * to struct rte_mbuf *,
the change can make code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_mbuf/rte_mbuf.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On Fri, Jan 19, 2018 at 06:18:13PM +0800, Zhiyong Yang wrote:
> It is unnecessary to cast from void * to struct rte_mbuf *,
> the change can make code clearer.
>
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Zhihong, for next time please prefix the patch with "PATCH v2"
and use --in-reply-to with the message id of the first version.
Thanks
Olivier
Olivier,
Thanks for your review and Acked-by, I will do that as you said next time.
Zhiyong
> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Monday, January 22, 2018 9:07 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>;
> thomas@monjalon.net
> Subject: Re: [PATCH] mbuf: remove void pointer cast
>
> On Fri, Jan 19, 2018 at 06:18:13PM +0800, Zhiyong Yang wrote:
> > It is unnecessary to cast from void * to struct rte_mbuf *, the change
> > can make code clearer.
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
>
> Zhihong, for next time please prefix the patch with "PATCH v2"
> and use --in-reply-to with the message id of the first version.
>
> Thanks
> Olivier
22/01/2018 14:07, Olivier Matz:
> On Fri, Jan 19, 2018 at 06:18:13PM +0800, Zhiyong Yang wrote:
> > It is unnecessary to cast from void * to struct rte_mbuf *,
> > the change can make code clearer.
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Applied, thanks
@@ -896,11 +896,9 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);
static inline struct rte_mbuf *rte_mbuf_raw_alloc(struct rte_mempool *mp)
{
struct rte_mbuf *m;
- void *mb = NULL;
- if (rte_mempool_get(mp, &mb) < 0)
+ if (rte_mempool_get(mp, (void **)&m) < 0)
return NULL;
- m = (struct rte_mbuf *)mb;
MBUF_RAW_ALLOC_CHECK(m);
return m;
}