chiark / gitweb /
comm: Use BUF_GET_BYTES
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 2 Oct 2014 14:44:18 +0000 (15:44 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 6 Oct 2014 22:29:37 +0000 (23:29 +0100)
There are two calls in udp_afterpoll which could use BUF_GET_BYTES.
Convert them.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
udp.c

diff --git a/udp.c b/udp.c
index 9bb12342ee65e99ea3d571f0c0ad7a7b24f303ee..d2c0aad7237a6adc8444533d095b26b00ae3cf80 100644 (file)
--- 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;