[Spice-devel] [PATCH spice-gtk 06/15] Avoid warnings about empty conditional statement bodies

Daniel P. Berrange berrange at redhat.com
Tue Mar 13 06:40:04 PDT 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

Add extra {} braces around if/else statements which only
call SPICE_DEBUG to avoid:

../common/ssl_verify.c: In function 'verify_pubkey':
../common/ssl_verify.c:87:50: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_hostname':
../common/ssl_verify.c:254:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_subject':
../common/ssl_verify.c:381:41: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
---
 common/ssl_verify.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/common/ssl_verify.c b/common/ssl_verify.c
index 8e9bbc9..02e7a20 100644
--- a/common/ssl_verify.c
+++ b/common/ssl_verify.c
@@ -79,12 +79,13 @@ static int verify_pubkey(X509* cert, const char *key, size_t key_size)
 
     ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey);
 
-    if (ret == 1)
+    if (ret == 1) {
         SPICE_DEBUG("public keys match");
-    else if (ret == 0)
+    } else if (ret == 0) {
         SPICE_DEBUG("public keys mismatch");
-    else
+    } else {
         SPICE_DEBUG("public keys types mismatch");
+    }
 
 finish:
     if (bio)
@@ -250,8 +251,9 @@ static int verify_hostname(X509* cert, const char *hostname)
         }
     }
 
-    if (!cn_match)
+    if (!cn_match) {
         SPICE_DEBUG("warning: common name mismatch");
+    }
 
     return cn_match;
 }
@@ -375,10 +377,11 @@ int verify_subject(X509* cert, SpiceOpenSSLVerify* verify)
 
     ret = X509_NAME_cmp(cert_subject, verify->in_subject);
 
-    if (ret == 0)
+    if (ret == 0) {
         SPICE_DEBUG("subjects match");
-    else
+    } else {
         SPICE_DEBUG("subjects mismatch");
+    }
 
     return !ret;
 }
-- 
1.7.7.6



More information about the Spice-devel mailing list