[Openvpn-devel] Simplify and inline clear_buf()

Message ID 20171110110858.11482-1-steffan@karger.me
State Accepted
Headers show
Series
  • [Openvpn-devel] Simplify and inline clear_buf()
Related show

Commit Message

Steffan Karger Nov. 10, 2017, 11:08 a.m.
Such a simple operation should not need a full function call.

Signed-off-by: Steffan Karger <steffan@karger.me>
---
 src/openvpn/buffer.c | 8 --------
 src/openvpn/buffer.h | 9 +++++++--
 2 files changed, 7 insertions(+), 10 deletions(-)

Comments

Gert Doering Nov. 10, 2017, 2:37 p.m. | #1
ACK.  Makes sense, simplifies things slightly, and passes all tests :)

Your patch has been applied to the master branch.

(I'm experimenting a bit with the formatting and the patchwork headers,
so do not wonder why the remainder looks a bit atypical)

commit 3280c4c2c7064c0c6719621703f46596212396fd
Author: Steffan Karger
Date:   Fri Nov 10 12:08:58 2017 +0100

     Simplify and inline clear_buf()

     Signed-off-by: Steffan Karger <steffan@karger.me>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     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 <gert@greenie.muc.de>


Acked-by: Gert Doering <gert@greenie.muc.de>
X-Patchwork-State: Accepted
--
kind regards,

Gert Doering


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Gert Doering Nov. 10, 2017, 2:45 p.m. | #2
HI,

On Fri, Nov 10, 2017 at 03:37:56PM +0100, Gert Doering wrote:
> ACK.  Makes sense, simplifies things slightly, and passes all tests :)
> 
> Your patch has been applied to the master branch.
> 
> (I'm experimenting a bit with the formatting and the patchwork headers,
> so do not wonder why the remainder looks a bit atypical)

So, just for the record:

> Acked-by: Gert Doering <gert@greenie.muc.de>

*this* gets picked up nicely, if (and only if!) it's on the start of 
the line.

(So, please send your ACKs in this format if you want patchwork to 
see them :-) )

> X-Patchwork-State: Accepted

*this* is totally ignored, no matter whether it's in the body or header.

More investigation needed...

gert

Patch

diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 7395ab29..4226a808 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 a754fc14..a088e181 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);
@@ -213,6 +211,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)
 {