[PATCH v2 02/22] Remove unnecessary curly brackets in daemon/ and examples/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 daemon/libvirtd.c                   | 15 +++++----------
 daemon/remote.c                     | 12 ++++--------
 examples/object-events/event-test.c |  3 +--
 examples/openauth/openauth.c        |  9 +++------
 4 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 1864bfd..b7f82c5 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -981,9 +981,8 @@ static int migrateProfile(void)
     if (!(home = virGetUserDirectory()))
         goto cleanup;

-    if (virAsprintf(&old_base, "%s/.libvirt", home) < 0) {
+    if (virAsprintf(&old_base, "%s/.libvirt", home) < 0)
         goto cleanup;
-    }

     /* if the new directory is there or the old one is not: do nothing */
     if (!(config_dir = virGetUserConfigDirectory()))
@@ -998,21 +997,18 @@ static int migrateProfile(void)
     }

     /* test if we already attempted to migrate first */
-    if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0) {
+    if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0)
         goto cleanup;
-    }
-    if (virFileExists(updated)) {
+    if (virFileExists(updated))
         goto cleanup;
-    }

     config_home = virGetEnvBlockSUID("XDG_CONFIG_HOME");
     if (config_home && config_home[0] != '\0') {
         if (VIR_STRDUP(xdg_dir, config_home) < 0)
             goto cleanup;
     } else {
-        if (virAsprintf(&xdg_dir, "%s/.config", home) < 0) {
+        if (virAsprintf(&xdg_dir, "%s/.config", home) < 0)
             goto cleanup;
-        }
     }

     old_umask = umask(077);
@@ -1164,9 +1160,8 @@ int main(int argc, char **argv) {

         c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);

-        if (c == -1) {
+        if (c == -1)
             break;
-        }

         switch (c) {
         case 0:
diff --git a/daemon/remote.c b/daemon/remote.c
index c93c97a..1d7082e 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -500,9 +500,8 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
               authScheme, callback->callbackID);

     VIR_DEBUG("Subject %d", subject->nidentity);
-    for (i = 0; i < subject->nidentity; i++) {
+    for (i = 0; i < subject->nidentity; i++)
         VIR_DEBUG("  %s=%s", subject->identities[i].type, subject->identities[i].name);
-    }

     /* build return data */
     memset(&data, 0, sizeof(data));
@@ -4268,9 +4267,8 @@ remoteDispatchDomainOpenGraphicsFd(virNetServerPtr server ATTRIBUTE_UNUSED,

  cleanup:
     VIR_FORCE_CLOSE(fd);
-    if (rv < 0) {
+    if (rv < 0)
         virNetMessageSaveError(rerr);
-    }

     if (dom)
         virDomainFree(dom);
@@ -5689,9 +5687,8 @@ remoteDispatchDomainCreateXMLWithFiles(virNetServerPtr server ATTRIBUTE_UNUSED,
     rv = 0;

  cleanup:
-    for (i = 0; i < nfiles; i++) {
+    for (i = 0; i < nfiles; i++)
         VIR_FORCE_CLOSE(files[i]);
-    }
     VIR_FREE(files);
     if (rv < 0)
         virNetMessageSaveError(rerr);
@@ -5741,9 +5738,8 @@ static int remoteDispatchDomainCreateWithFiles(virNetServerPtr server ATTRIBUTE_
     rv = 0;

  cleanup:
-    for (i = 0; i < nfiles; i++) {
+    for (i = 0; i < nfiles; i++)
         VIR_FORCE_CLOSE(files[i]);
-    }
     VIR_FREE(files);
     if (rv < 0)
         virNetMessageSaveError(rerr);
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 0c6faf4..8987ee5 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -730,9 +730,8 @@ int main(int argc, char **argv)
     virConnectUnregisterCloseCallback(dconn, connectClose);

     VIR_DEBUG("Closing connection");
-    if (dconn && virConnectClose(dconn) < 0) {
+    if (dconn && virConnectClose(dconn) < 0)
         printf("error closing\n");
-    }

     printf("done\n");
     return 0;
diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c
index fae96e0..0be977e 100644
--- a/examples/openauth/openauth.c
+++ b/examples/openauth/openauth.c
@@ -132,9 +132,8 @@ showDomains(virConnectPtr conn)
         goto out;
     }

-    if (numNames > 0) {
+    if (numNames > 0)
         printf("Inactive domains:\n");
-    }

     for (i = 0; i < numNames; i++) {
         printf("  %s\n", *(nameList + i));
@@ -181,9 +180,8 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
         case VIR_CRED_AUTHNAME:
             cred[i].result = strdup(authData->username);

-            if (cred[i].result == NULL) {
+            if (cred[i].result == NULL)
                 return -1;
-            }

             cred[i].resultlen = strlen(cred[i].result);
             break;
@@ -191,9 +189,8 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
         case VIR_CRED_PASSPHRASE:
             cred[i].result = strdup(authData->password);

-            if (cred[i].result == NULL) {
+            if (cred[i].result == NULL)
                 return -1;
-            }

             cred[i].resultlen = strlen(cred[i].result);
             break;
-- 
2.1.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]