Re: [PATCH] Omitting braces with a single-line body

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

 



On 22/04/13 20:33, harryxiyou@xxxxxxxxx wrote:
From: Harry Wei <harryxiyou@xxxxxxxxx>

After i read libvirt/HACKING file, i find we should

s/i/I/,

Omit braces with a single-line body. So this patch
fix this coding style problem for Sheepdog storage

s/fix this/fixes the/,

backend driver.

The commit log can be more compact:

Prefer no braces for single line bodies.


Signed-off-by: Harry Wei <harryxiyou@xxxxxxxxx>
---
  src/storage/storage_backend_sheepdog.c |   11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 35a3a04..15fa29c 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -97,12 +97,10 @@ virStorageBackendSheepdogAddHostArg(virCommandPtr cmd,
      const char *address = "localhost";
      int port = 7000;
      if (pool->def->source.nhost > 0) {
-        if (pool->def->source.hosts[0].name != NULL) {
+        if (pool->def->source.hosts[0].name != NULL)
              address = pool->def->source.hosts[0].name;
-        }
-        if (pool->def->source.hosts[0].port) {
+        if (pool->def->source.hosts[0].port)
              port = pool->def->source.hosts[0].port;
-        }
      }
      virCommandAddArg(cmd, "-a");
      virCommandAddArgFormat(cmd, "%s", address);
@@ -210,11 +208,10 @@ virStorageBackendSheepdogParseVdiList(virStorageVolDefPtr vol,
              continue;
/* skip space */
-        if (p + 2 < next) {
+        if (p + 2 < next)
              p += 2;
-        } else {
+        else
              return -1;
-        }
/* skip name */
          while (*p != '\0' && *p != ' ') {

ACK

--
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]