Prefer structure assignment over memcpy.
Found by cocci/struct_assign.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/bbdev_app/main.c | 2 +-
examples/l2fwd-cat/cat.c | 3 +--
examples/ptpclient/ptpclient.c | 4 +---
3 files changed, 3 insertions(+), 6 deletions(-)
@@ -360,7 +360,7 @@ add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst)
eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *);
/* copy header */
- rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr));
+ *eth_to = *eth_from;
}
static inline void
@@ -314,8 +314,7 @@ parse_l3ca(const char *l3ca)
if (cmask != 0 && is_contiguous(cmask) == 0)
goto err;
- rte_memcpy(&m_config[idx].cpumask,
- &cpuset, sizeof(rte_cpuset_t));
+ m_config[idx].cpumask = cpuset;
if (cmask != 0) {
m_config[idx].cdp = 1;
@@ -470,9 +470,7 @@ parse_fup(struct ptpv2_time_receiver_ordinary *ptp_data)
client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4];
client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5];
- rte_memcpy(&ptp_data->client_clock_id,
- client_clkid,
- sizeof(struct clock_id));
+ ptp_data->client_clock_id = *client_clkid;
/* Enable flag for hardware timestamping. */
created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST;