On 17/07/2020 13:29, Arne Schwabe wrote:
> The return false/return true is the result of
> running uncrustify.
> 
> Signed-off-by: Arne Schwabe <a...@rfc2549.org>
> ---
>  src/openvpn/multi.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
> index 97b7df16..1fdf6ce5 100644
> --- a/src/openvpn/multi.c
> +++ b/src/openvpn/multi.c
> @@ -2229,22 +2229,16 @@ static inline bool
>  cc_check_return(int *cc_succeeded_count,
>                  enum client_connect_return ret)
>  {
> -    if (ret == CC_RET_SUCCEEDED)
> +    switch (ret)
>      {
> -        (*cc_succeeded_count)++;
> -        return true;
> -    }
> -    else if (ret == CC_RET_FAILED)
> -    {
> -        return false;
> -    }
> -    else if (ret == CC_RET_SKIPPED)
> -    {
> -        return true;
> -    }
> -    else
> -    {
> -        ASSERT(0);
> +        case CC_RET_SUCCEEDED: (*cc_succeeded_count)++;
> +            return true;
> +
> +        case CC_RET_FAILED: return false;
> +
> +        case CC_RET_SKIPPED: return true;
> +
> +        default: ASSERT(0);

Code style police .... Even though it is not clearly defined, but based on the
example here
<https://community.openvpn.net/openvpn/wiki/CodeStyle#Casesinaswitchstatementshouldbreakorexplicitlyfallthrough>
...

... it should be more like:

   switch (ret)
   {
        case CC_RET_SUCCEEDED:
            (*cc_succeeded_count)++;
            return true;

        case CC_RET_FAILED:
            return false;

        case CC_RET_SKIPPED:
            return true;

        default:
            ASSERT(0);
   }


I generally find this approach more readable.


-- 
kind regards,

David Sommerseth
OpenVPN Inc


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to