Skip to contentSkip to conversation

tun.h: change tun_set() return value type to void

PATCH In review Lev Stipakov 4 participants 4 messages Sep 6, 2019 – Sep 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun.h: change tun_set() return value type to void

This function's return value is never used, so make it void.

---
 src/openvpn/tun.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
src/openvpn/tun.h +1 -2
index 69831c4..475643a 100644
@@ -513,7 +513,7 @@ tun_event_handle(const struct tuntap *tt)
 #endif
 }
 
-static inline unsigned int
+static inline void
 tun_set(struct tuntap *tt,
         struct event_set *es,
         unsigned int rwflags,
@@ -539,7 +539,6 @@ tun_set(struct tuntap *tt,
 #endif
         tt->rwflags_debug = rwflags;
     }
-    return rwflags;
 }
 
 const char *tun_stat(const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#2 lore raw
In reply to Lev Stipakov
Quoted 12 lines · Lev Stipakov

This function's return value is never used, so make it void.

---
 src/openvpn/tun.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
src/openvpn/tun.h +0 -0
index 69831c4..475643a 100644

src/openvpn/tun.h tun_event_handle(const struct tuntap *tt) · line 519

Quoted 8 lines
src/openvpn/tun.h +1 -1
@@ -513,7 +513,7 @@ tun_event_handle(const struct tuntap *tt)
 #endif
 }
 
-static inline unsigned int
+static inline void
 tun_set(struct tuntap *tt,
         struct event_set *es,
         unsigned int rwflags,

I did some check into the history of this function, even going into the openvpn-historical-cvs git repository. The return value of this function was defined as unsigned int since the very beginning - going back to OpenVPN 2.0_beta18 - which basically was the first public commit after the 1.6.0 release. In my very quick look, not even once has the return value been used since that time.

So this change makes sense. No need to have a return value which has not been interesting since November 2004.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#3 lore raw
In reply to Lev Stipakov

Your patch has been applied to the master branch.

commit 3d52205097bee3106de9776dae8bcc93eca7ab72

Author: Lev Stipakov
Date:   Fri Sep 6 18:40:37 2019 +0300
     tun.h: change tun_set() return value type to void

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg18804.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering