Skip to contentSkip to conversation

Simplify and inline clear_buf()

PATCH In review Steffan Karger 2 participants 3 messages Nov 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Simplify and inline clear_buf()

Such a simple operation should not need a full function call.

---
 src/openvpn/buffer.c | 8 --------
 src/openvpn/buffer.h | 9 +++++++--
 2 files changed, 7 insertions(+), 10 deletions(-)
src/openvpn/buffer.c +0 -8
index 7395ab29..4226a808 100644
@@ -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)
 {
src/openvpn/buffer.h +7 -2
index a754fc14..a088e181 100644
@@ -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)
 {
Signature · 1 line
2.14.1
Acked-by on v1 1/1
#1 lore raw

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 <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg15796.html
     Signed-off-by: Gert Doering <[email protected]...>

X-Patchwork-State: Accepted
--
kind regards,

Gert Doering

#2 lore raw

HI,

Quoted 6 lines · Gert Doering

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:

Quoted 1 line

*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 :-) )

Quoted 1 line

X-Patchwork-State: Accepted

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

More investigation needed...

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...