[vlc-devel] [PATCH] misc/gnutls: do not declare variable if not needed
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Wed Mar 15 19:16:35 CET 2017
On Wed, Mar 15, 2017, at 10:07 AM, Filip Roséen wrote:
> The variable in question is only needed within the preprocessor-if
> that follows, as such it makes more sense to declare only declare it
> if that is actually reached (while also supressing a warning
> diagnostic related to the variable being unused).
>
> An empty statement has been added after the label in order to comply
> with the ISO C Standard, which mandates that a label preceedes a
> statement (which a variable declaration is not).
> ---
> modules/misc/gnutls.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
> index 3b83a9b84b..f3e5d44ccb 100644
> --- a/modules/misc/gnutls.c
> +++ b/modules/misc/gnutls.c
> @@ -348,10 +348,11 @@ static int gnutls_ContinueHandshake(vlc_tls_creds_t
> *crd,
> msg_Err(crd, "TLS handshake error: %s", gnutls_strerror (val));
> return -1;
>
> - unsigned flags;
> done:
> #if (GNUTLS_VERSION_NUMBER >= 0x030500)
> - flags = gnutls_session_get_flags(session);
> + /* intentionally left blank */;
> +
> + unsigned flags = gnutls_session_get_flags(session);
>
> if (flags & GNUTLS_SFLAGS_SAFE_RENEGOTIATION)
> msg_Dbg(crd, " - safe renegotiation (RFC5746) enabled");
> --
> 2.12.0
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
I'm not entirely convinced this improves the code readability, I'll
gladly take some other opinions before applying/rejecting.
Regards,
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list