From: Ian Jackson Date: Thu, 2 Oct 2014 14:44:18 +0000 (+0100) Subject: comm: Use BUF_GET_BYTES X-Git-Tag: proposed.polypath.v4~49 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=c1ddd026a2cc6d68a0d47033817a3d9b7670a71e comm: Use BUF_GET_BYTES There are two calls in udp_afterpoll which could use BUF_GET_BYTES. Convert them. Signed-off-by: Ian Jackson --- diff --git a/udp.c b/udp.c index 9bb1234..d2c0aad 100644 --- a/udp.c +++ b/udp.c @@ -137,9 +137,9 @@ static void udp_afterpoll(void *state, struct pollfd *fds, int nfds) } /* proxy protocol supports ipv4 transport only */ from.sa.sa_family=AF_INET; - memcpy(&from.sin.sin_addr,buf_unprepend(cc->rbuf,4),4); + BUF_GET_BYTES(unprepend,cc->rbuf,&from.sin.sin_addr,4); buf_unprepend(cc->rbuf,2); - memcpy(&from.sin.sin_port,buf_unprepend(cc->rbuf,2),2); + BUF_GET_BYTES(unprepend,cc->rbuf,&from.sin.sin_port,2); } struct comm_addr ca; ca.comm=&cc->ops;