Skip to contentSkip to conversation

mbuf: fix incompatibility with C++ in header file

PATCH In review Avi Kivity 2 participants 2 messages Aug 14, 2015

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 mbuf: fix incompatibility with C++ in header file

C++ doesn't allow implied casting from void * to another pointer, so supply an explicit cast.

---
 lib/librte_mbuf/rte_mbuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_mbuf/rte_mbuf.h +1 -1
index c3b8c98..8c2db1b 100644
@@ -882,7 +882,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
 static inline struct rte_mbuf *
 rte_mbuf_from_indirect(struct rte_mbuf *mi)
 {
-	return RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
+	return (struct rte_mbuf *)RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
 }
 
 /**
Signature · 1 line
2.4.3
#1 lore raw

The patch duplicates http://dpdk.org/dev/patchwork/patch/6750/

Quoted 21 lines · On Friday 14 August 2015 11:33:15 Avi Kivity wrote:

C++ doesn't allow implied casting from void * to another pointer, so supply an explicit cast.

---
 lib/librte_mbuf/rte_mbuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_mbuf/rte_mbuf.h +0 -0
index c3b8c98..8c2db1b 100644
@@ -882,7 +882,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct

rte_mempool *mp); static inline struct rte_mbuf *
rte_mbuf_from_indirect(struct rte_mbuf *mi)
{

lib/librte_mbuf/rte_mbuf.h +1 -1
-	return RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
+	return (struct rte_mbuf *)RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) +

mi->priv_size); }

/**