From: Steffan Karger Date: Fri, 10 Nov 2017 11:08:58 +0000 (+0100) Subject: Simplify and inline clear_buf() X-Git-Tag: v2.5_beta1~562 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3280c4c2c7064c0c6719621703f46596212396fd;p=thirdparty%2Fopenvpn.git Simplify and inline clear_buf() Such a simple operation should not need a full function call. Signed-off-by: Steffan Karger Acked-by: Gert Doering Message-Id: <20171110110858.11482-1-steffan@karger.me> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15796.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index a63ce14a4..ecd3b17f3 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -179,14 +179,6 @@ buf_assign(struct buffer *dest, const struct buffer *src) return buf_write(dest, BPTR(src), BLEN(src)); } -struct buffer -clear_buf(void) -{ - struct buffer buf; - CLEAR(buf); - return buf; -} - void free_buf(struct buffer *buf) { diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 1ed56316c..84ad3efaf 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -131,8 +131,6 @@ struct gc_arena void buf_clear(struct buffer *buf); -struct buffer clear_buf(void); - void free_buf(struct buffer *buf); bool buf_assign(struct buffer *dest, const struct buffer *src); @@ -206,6 +204,13 @@ gc_freeaddrinfo_callback(void *addr) freeaddrinfo((struct addrinfo *) addr); } +/** Return an empty struct buffer */ +static inline struct buffer +clear_buf(void) +{ + return (struct buffer) { 0 }; +} + static inline bool buf_defined(const struct buffer *buf) {