[Openvpn-devel] tun.h: change tun_set() return value type to void

Message ID 1567784437-25922-1-git-send-email-lstipakov@gmail.com
State Accepted
Headers show
Series [Openvpn-devel] tun.h: change tun_set() return value type to void | expand

Commit Message

Lev Stipakov Sept. 6, 2019, 5:40 a.m. UTC
This function's return value is never used, so make it void.

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
---
 src/openvpn/tun.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Antonio Quartulli Sept. 6, 2019, 9:14 a.m. UTC | #1
Hi,

On 06/09/2019 17:40, Lev Stipakov wrote:
> This function's return value is never used, so make it void.
> 
> Signed-off-by: Lev Stipakov <lstipakov@gmail.com>

Does what it says and git suggests that its return value was never used.
Using void as return type also clarifies its usage.

Acked-by: Antonio Quartulli <a@unstable.cc>
David Sommerseth Sept. 9, 2019, 12:18 p.m. UTC | #2
On 06/09/2019 17:40, Lev Stipakov wrote:
> This function's return value is never used, so make it void.
> 
> Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
> ---
>  src/openvpn/tun.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h
> index 69831c4..475643a 100644
> --- a/src/openvpn/tun.h
> +++ b/src/openvpn/tun.h
> @@ -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.

Acked-By: David Sommerseth <davids@openvpn.net>
Gert Doering Sept. 18, 2019, 1:33 a.m. UTC | #3
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 <lstipakov@gmail.com>
     Acked-by: Antonio Quartulli <antonio@openvpn.net>
     Acked-by: David Sommerseth <davids@openvpn.net>
     Message-Id: <1567784437-25922-1-git-send-email-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18804.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h
index 69831c4..475643a 100644
--- a/src/openvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -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);