[libvirt] [PATCH 1/2] syntax: prefer space after semicolon in for loop

Eric Blake eblake at redhat.com
Fri May 24 17:19:36 UTC 2013


I noticed several unusual spacings in for loops, and decided to
fix them up.  See the next commit for the syntax check that found
all of these.

* examples/domsuspend/suspend.c (main): Fix spacing.
* python/libvirt-override.c: Likewise.
* src/conf/interface_conf.c: Likewise.
* src/security/virt-aa-helper.c: Likewise.
* src/util/virconf.c: Likewise.
* src/util/virhook.c: Likewise.
* src/util/virlog.c: Likewise.
* src/util/virsocketaddr.c: Likewise.
* src/util/virsysinfo.c: Likewise.
* src/util/viruuid.c: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
default case, to let compiler check us.
* tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 examples/domsuspend/suspend.c |  2 +-
 python/libvirt-override.c     | 38 +++++++++++++++++++-------------------
 src/conf/interface_conf.c     | 14 +++++++-------
 src/security/virt-aa-helper.c |  2 +-
 src/util/virconf.c            |  4 ++--
 src/util/virhook.c            |  2 +-
 src/util/virlog.c             | 10 +++++-----
 src/util/virsocketaddr.c      | 12 ++++++------
 src/util/virsysinfo.c         |  4 ++--
 src/util/viruuid.c            |  4 ++--
 src/vbox/vbox_tmpl.c          | 11 ++++++++---
 src/xen/xen_hypervisor.c      |  3 ++-
 tools/virsh-domain-monitor.c  |  6 +++---
 tools/virsh-domain.c          |  6 +++---
 14 files changed, 62 insertions(+), 56 deletions(-)

diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c
index a6311d1..d9f56bb 100644
--- a/examples/domsuspend/suspend.c
+++ b/examples/domsuspend/suspend.c
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
             fprintf(stderr, "Failed to list the domains\n");
             goto error;
         }
-        for (j = 0;j < i;j++) {
+        for (j = 0; j < i; j++) {
             if (ids[j] != 0) {
                 id = ids[j];
                 break;
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 6ed2624..b6462c2 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2176,7 +2176,7 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (ids) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_intWrap(ids[i]));
         }
         VIR_FREE(ids);
@@ -2266,7 +2266,7 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -2745,7 +2745,7 @@ libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -2790,7 +2790,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -2997,7 +2997,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
         return VIR_PY_NONE;
     }
     py_retval = PyList_New(c_retval);
-    for (i = 0;i < c_retval;i++) {
+    for (i = 0; i < c_retval; i++) {
         PyList_SetItem(py_retval, i,
                 libvirt_longlongWrap((long long) freeMems[i]));
     }
@@ -3165,7 +3165,7 @@ libvirt_virConnectListStoragePools(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     if (py_retval == NULL) {
         if (names) {
-            for (i = 0;i < c_retval;i++)
+            for (i = 0; i < c_retval; i++)
                 VIR_FREE(names[i]);
             VIR_FREE(names);
         }
@@ -3173,7 +3173,7 @@ libvirt_virConnectListStoragePools(PyObject *self ATTRIBUTE_UNUSED,
     }

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -3218,7 +3218,7 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     if (py_retval == NULL) {
         if (names) {
-            for (i = 0;i < c_retval;i++)
+            for (i = 0; i < c_retval; i++)
                 VIR_FREE(names[i]);
             VIR_FREE(names);
         }
@@ -3226,7 +3226,7 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self ATTRIBUTE_UNUSED,
     }

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -3317,7 +3317,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     if (py_retval == NULL) {
         if (names) {
-            for (i = 0;i < c_retval;i++)
+            for (i = 0; i < c_retval; i++)
                 VIR_FREE(names[i]);
             VIR_FREE(names);
         }
@@ -3325,7 +3325,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
     }

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -3578,7 +3578,7 @@ libvirt_virNodeListDevices(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -3668,7 +3668,7 @@ libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -3787,7 +3787,7 @@ libvirt_virConnectListSecrets(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (uuids) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(uuids[i]));
             VIR_FREE(uuids[i]);
         }
@@ -4006,7 +4006,7 @@ libvirt_virConnectListNWFilters(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);

     if (uuids) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(uuids[i]));
             VIR_FREE(uuids[i]);
         }
@@ -4097,7 +4097,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     if (py_retval == NULL) {
         if (names) {
-            for (i = 0;i < c_retval;i++)
+            for (i = 0; i < c_retval; i++)
                 VIR_FREE(names[i]);
             VIR_FREE(names);
         }
@@ -4105,7 +4105,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
     }

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
@@ -4151,7 +4151,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
     py_retval = PyList_New(c_retval);
     if (py_retval == NULL) {
         if (names) {
-            for (i = 0;i < c_retval;i++)
+            for (i = 0; i < c_retval; i++)
                 VIR_FREE(names[i]);
             VIR_FREE(names);
         }
@@ -4159,7 +4159,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
     }

     if (names) {
-        for (i = 0;i < c_retval;i++) {
+        for (i = 0; i < c_retval; i++) {
             PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
             VIR_FREE(names[i]);
         }
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index d8100ed..025a454 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1,7 +1,7 @@
 /*
  * interface_conf.c: interfaces XML handling
  *
- * Copyright (C) 2006-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2010, 2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -80,7 +80,7 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
     switch (def->type) {
         case VIR_INTERFACE_TYPE_BRIDGE:
             VIR_FREE(def->data.bridge.delay);
-            for (i = 0;i < def->data.bridge.nbItf;i++) {
+            for (i = 0; i < def->data.bridge.nbItf; i++) {
                 if (def->data.bridge.itf[i] == NULL)
                     break; /* to cope with half parsed data on errors */
                 virInterfaceDefFree(def->data.bridge.itf[i]);
@@ -89,7 +89,7 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
             break;
         case VIR_INTERFACE_TYPE_BOND:
             VIR_FREE(def->data.bond.target);
-            for (i = 0;i < def->data.bond.nbItf;i++) {
+            for (i = 0; i < def->data.bond.nbItf; i++) {
                 if (def->data.bond.itf[i] == NULL)
                     break; /* to cope with half parsed data on errors */
                 virInterfaceDefFree(def->data.bond.itf[i]);
@@ -504,7 +504,7 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
         }
         def->data.bridge.nbItf = nbItf;

-        for (i = 0; i < nbItf;i++) {
+        for (i = 0; i < nbItf; i++) {
             ctxt->node = interfaces[i];
             itf = virInterfaceDefParseXML(ctxt, VIR_INTERFACE_TYPE_BRIDGE);
             if (itf == NULL) {
@@ -551,7 +551,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
     }
     def->data.bond.nbItf = nbItf;

-    for (i = 0; i < nbItf;i++) {
+    for (i = 0; i < nbItf; i++) {
         ctxt->node = interfaces[i];
         itf = virInterfaceDefParseXML(ctxt, VIR_INTERFACE_TYPE_BOND);
         if (itf == NULL) {
@@ -886,7 +886,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
         virBufferAsprintf(buf, " delay='%s'", def->data.bridge.delay);
     virBufferAddLit(buf, ">\n");

-    for (i = 0;i < def->data.bridge.nbItf;i++) {
+    for (i = 0; i < def->data.bridge.nbItf; i++) {
         if (virInterfaceDefDevFormat(buf,
                                      def->data.bridge.itf[i], level+2) < 0)
             ret = -1;
@@ -948,7 +948,7 @@ virInterfaceBondDefFormat(virBufferPtr buf,
             virBufferAddLit(buf, " validate='all'");
         virBufferAddLit(buf, "/>\n");
     }
-    for (i = 0;i < def->data.bond.nbItf;i++) {
+    for (i = 0; i < def->data.bond.nbItf; i++) {
         if (virInterfaceDefDevFormat(buf, def->data.bond.itf[i], level+2) < 0)
             ret = -1;
     }
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index f16a35b..02359fc 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -71,7 +71,7 @@ typedef struct {
     char *files;                /* list of files */
     virDomainDefPtr def;        /* VM definition */
     virCapsPtr caps;            /* VM capabilities */
-    virDomainXMLOptionPtr xmlopt;/* XML parser data */
+    virDomainXMLOptionPtr xmlopt; /* XML parser data */
     char *hvm;                  /* type of hypervisor (eg hvm, xen) */
     virArch arch;               /* machine architecture */
     char *newfile;              /* newly added file */
diff --git a/src/util/virconf.c b/src/util/virconf.c
index c578bf4..ef76369 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1,7 +1,7 @@
 /*
  * virconf.c: parser for a subset of the Python encoded Xen configuration files
  *
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -67,7 +67,7 @@ struct _virConfParserCtxt {
 #define SKIP_BLANKS_AND_EOL                                             \
   do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR) || IS_EOL(CUR))) { \
          if (CUR == '\n') ctxt->line++;	                                \
-         ctxt->cur++;}} while (0)
+         ctxt->cur++; } } while (0)
 #define SKIP_BLANKS                                                     \
   do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR)))              \
           ctxt->cur++; } while (0)
diff --git a/src/util/virhook.c b/src/util/virhook.c
index 508c268..507eae2 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -142,7 +142,7 @@ virHookInitialize(void) {
     int i, res, ret = 0;

     virHooksFound = 0;
-    for (i = 0;i < VIR_HOOK_DRIVER_LAST;i++) {
+    for (i = 0; i < VIR_HOOK_DRIVER_LAST; i++) {
         res = virHookCheck(i, virHookDriverTypeToString(i));
         if (res < 0)
             return -1;
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 348bddc..f456cb9 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -371,7 +371,7 @@ virLogDumpAllFD(const char *msg, int len)
     if (len <= 0)
         len = strlen(msg);

-    for (i = 0; i < virLogNbOutputs;i++) {
+    for (i = 0; i < virLogNbOutputs; i++) {
         if (virLogOutputs[i].f == virLogOutputToFd) {
             int fd = (intptr_t) virLogOutputs[i].data;

@@ -514,7 +514,7 @@ virLogResetFilters(void)
 {
     int i;

-    for (i = 0; i < virLogNbFilters;i++)
+    for (i = 0; i < virLogNbFilters; i++)
         VIR_FREE(virLogFilters[i].match);
     VIR_FREE(virLogFilters);
     virLogNbFilters = 0;
@@ -550,7 +550,7 @@ virLogDefineFilter(const char *match,
         return -1;

     virLogLock();
-    for (i = 0;i < virLogNbFilters;i++) {
+    for (i = 0; i < virLogNbFilters; i++) {
         if (STREQ(virLogFilters[i].match, match)) {
             virLogFilters[i].priority = priority;
             goto cleanup;
@@ -597,7 +597,7 @@ virLogFiltersCheck(const char *input,
     int i;

     virLogLock();
-    for (i = 0;i < virLogNbFilters;i++) {
+    for (i = 0; i < virLogNbFilters; i++) {
         if (strstr(input, virLogFilters[i].match)) {
             ret = virLogFilters[i].priority;
             *flags = virLogFilters[i].flags;
@@ -621,7 +621,7 @@ virLogResetOutputs(void)
 {
     int i;

-    for (i = 0;i < virLogNbOutputs;i++) {
+    for (i = 0; i < virLogNbOutputs; i++) {
         if (virLogOutputs[i].c != NULL)
             virLogOutputs[i].c(virLogOutputs[i].data);
         VIR_FREE(virLogOutputs[i].name);
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 1a6714e..1071b00 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -49,7 +49,7 @@ static int virSocketAddrGetIPv4Addr(virSocketAddrPtr addr, virSocketAddrIPv4Ptr

     val = ntohl(addr->data.inet4.sin_addr.s_addr);

-    for (i = 0;i < 4;i++) {
+    for (i = 0; i < 4; i++) {
         (*tab)[3 - i] = val & 0xFF;
         val >>= 8;
     }
@@ -63,7 +63,7 @@ static int virSocketAddrGetIPv6Addr(virSocketAddrPtr addr, virSocketAddrIPv6Ptr
     if ((addr == NULL) || (tab == NULL) || (addr->data.stor.ss_family != AF_INET6))
         return -1;

-    for (i = 0;i < 8;i++) {
+    for (i = 0; i < 8; i++) {
         (*tab)[i] = ((addr->data.inet6.sin6_addr.s6_addr[2 * i] << 8) |
                      addr->data.inet6.sin6_addr.s6_addr[2 * i + 1]);
     }
@@ -530,7 +530,7 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
             (virSocketAddrGetIPv4Addr(netmask, &tm) < 0))
             return -1;

-        for (i = 0;i < 4;i++) {
+        for (i = 0; i < 4; i++) {
             if ((t1[i] & tm[i]) != (t2[i] & tm[i]))
                 return 0;
         }
@@ -543,7 +543,7 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
             (virSocketAddrGetIPv6Addr(netmask, &tm) < 0))
             return -1;

-        for (i = 0;i < 8;i++) {
+        for (i = 0; i < 8; i++) {
             if ((t1[i] & tm[i]) != (t2[i] & tm[i]))
                 return 0;
         }
@@ -581,7 +581,7 @@ int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end) {
             (virSocketAddrGetIPv4Addr(end, &t2) < 0))
             return -1;

-        for (i = 0;i < 2;i++) {
+        for (i = 0; i < 2; i++) {
             if (t1[i] != t2[i])
                 return -1;
         }
@@ -596,7 +596,7 @@ int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end) {
             (virSocketAddrGetIPv6Addr(end, &t2) < 0))
             return -1;

-        for (i = 0;i < 7;i++) {
+        for (i = 0; i < 7; i++) {
             if (t1[i] != t2[i])
                 return -1;
         }
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 4868a5f..c6d3a71 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -91,7 +91,7 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
     VIR_FREE(def->system_sku);
     VIR_FREE(def->system_family);

-    for (i = 0;i < def->nprocessor;i++) {
+    for (i = 0; i < def->nprocessor; i++) {
         VIR_FREE(def->processor[i].processor_socket_destination);
         VIR_FREE(def->processor[i].processor_type);
         VIR_FREE(def->processor[i].processor_family);
@@ -105,7 +105,7 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
         VIR_FREE(def->processor[i].processor_part_number);
     }
     VIR_FREE(def->processor);
-    for (i = 0;i < def->nmemory;i++) {
+    for (i = 0; i < def->nmemory; i++) {
         VIR_FREE(def->memory[i].memory_size);
         VIR_FREE(def->memory[i].memory_form_factor);
         VIR_FREE(def->memory[i].memory_locator);
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index 8f82187..9f4bb13 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -1,7 +1,7 @@
 /*
  * viruuid.h: helper APIs for dealing with UUIDs
  *
- * Copyright (C) 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2007-2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -160,7 +160,7 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) {
     while (c_isspace(*cur))
         cur++;

-    for (i = 0;i < VIR_UUID_BUFLEN;) {
+    for (i = 0; i < VIR_UUID_BUFLEN;) {
         uuid[i] = 0;
         if (*cur == 0)
             goto error;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index d37888c..9ddb3ad 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2938,7 +2938,7 @@ sharedFoldersCleanup:
             }

             /* Now get the details about the network cards here */
-            for (i = 0;(netAdpIncCnt < def->nnets) && (i < netAdpCnt); i++) {
+            for (i = 0; netAdpIncCnt < def->nnets && i < netAdpCnt; i++) {
                 INetworkAdapter *adapter = NULL;

                 machine->vtbl->GetNetworkAdapter(machine, i, &adapter);
@@ -3216,7 +3216,9 @@ sharedFoldersCleanup:
             }

             /* Now get the details about the serial ports here */
-            for (i = 0;(serialPortIncCount < def->nserials) && (i < serialPortCount); i++) {
+            for (i = 0;
+                 serialPortIncCount < def->nserials && i < serialPortCount;
+                 i++) {
                 ISerialPort *serialPort = NULL;

                 machine->vtbl->GetSerialPort(machine, i, &serialPort);
@@ -3300,7 +3302,10 @@ sharedFoldersCleanup:
             }

             /* Now get the details about the parallel ports here */
-            for (i = 0;(parallelPortIncCount < def->nparallels) && (i < parallelPortCount); i++) {
+            for (i = 0;
+                 parallelPortIncCount < def->nparallels &&
+                     i < parallelPortCount;
+                 i++) {
                 IParallelPort *parallelPort = NULL;

                 machine->vtbl->GetParallelPort(machine, i, &parallelPort);
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 11ba516..cfc8139 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2873,7 +2873,8 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
     memset(&op_sys, 0, sizeof(op_sys));
     op_sys.cmd = XEN_V2_OP_GETAVAILHEAP;

-    for (i = startCell, j = 0;(i < priv->nbNodeCells) && (j < maxCells);i++,j++) {
+    for (i = startCell, j = 0;
+         i < priv->nbNodeCells && j < maxCells; i++, j++) {
         if (hv_versions.sys_interface >= 5)
             op_sys.u.availheap5.node = i;
         else
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 5ed89d1..b284154 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain-monitor.c: Commands to monitor domain status
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -156,8 +156,8 @@ vshDomainStateToString(int state)
     case VIR_DOMAIN_PMSUSPENDED:
         return N_("pmsuspended");
     case VIR_DOMAIN_NOSTATE:
-    default:
-        ;/*FALLTHROUGH*/
+    case VIR_DOMAIN_LAST:
+        break;
     }
     return N_("no state");  /* = dom0 state */
 }
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0402aef..4fdf4ba 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -114,15 +114,15 @@ vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
 static const char *
 vshDomainVcpuStateToString(int state)
 {
-    switch (state) {
+    switch ((virVcpuState) state) {
     case VIR_VCPU_OFFLINE:
         return N_("offline");
     case VIR_VCPU_BLOCKED:
         return N_("idle");
     case VIR_VCPU_RUNNING:
         return N_("running");
-    default:
-        ;/*FALLTHROUGH*/
+    case VIR_VCPU_LAST:
+        break;
     }
     return N_("no state");
 }
-- 
1.8.1.4




More information about the libvir-list mailing list