[vlc-devel] [PATCH] misc/gnutls: do not declare variable if not needed

Filip Roséen filip at atch.se
Wed Mar 15 10:07:47 CET 2017

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;
 #if (GNUTLS_VERSION_NUMBER >= 0x030500)
-    flags = gnutls_session_get_flags(session);
+    /* intentionally left blank */;
+    unsigned flags = gnutls_session_get_flags(session);
         msg_Dbg(crd, " - safe renegotiation (RFC5746) enabled");

More information about the vlc-devel mailing list