[libvirt] [PATCH 1/4] Replace two-state local integers with bool

Ján Tomko jtomko at redhat.com
Fri May 24 11:02:19 UTC 2013


Found with 'git grep "= 1"'.
---
 src/conf/domain_conf.c                    | 18 +++++-----
 src/conf/nwfilter_conf.c                  | 56 +++++++++++++++----------------
 src/lxc/lxc_controller.c                  |  4 +--
 src/lxc/lxc_process.c                     |  4 +--
 src/nwfilter/nwfilter_ebiptables_driver.c | 10 +++---
 src/nwfilter/nwfilter_gentech_driver.c    |  4 +--
 src/qemu/qemu_agent.c                     |  6 ++--
 src/qemu/qemu_capabilities.c              |  8 ++---
 src/qemu/qemu_command.c                   | 39 ++++++++++-----------
 src/qemu/qemu_driver.c                    |  6 ++--
 src/qemu/qemu_migration.c                 | 20 +++++------
 src/qemu/qemu_monitor.c                   |  6 ++--
 src/qemu/qemu_monitor_json.c              |  8 ++---
 src/qemu/qemu_monitor_text.c              | 16 ++++-----
 src/qemu/qemu_process.c                   | 14 ++++----
 src/remote/remote_driver.c                |  5 ++-
 src/rpc/virnetserver.c                    |  6 ++--
 src/storage/storage_backend.c             |  4 +--
 src/util/vircgroup.c                      |  4 +--
 src/util/virlog.c                         | 15 +++++----
 src/util/virpci.c                         | 12 +++----
 src/util/viruri.c                         |  5 +--
 src/util/virutil.c                        | 12 +++----
 tests/reconnect.c                         |  6 ++--
 tests/ssh.c                               |  8 ++---
 25 files changed, 148 insertions(+), 148 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ad5550c..2a8ea5a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3471,7 +3471,7 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node,
 {
 
     int ret = -1;
-    int got_product, got_vendor;
+    bool got_product, got_vendor;
     xmlNodePtr cur;
     char *startupPolicy = NULL;
     char *autoAddress;
@@ -3497,8 +3497,8 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node,
 
     /* Product can validly be 0, so we need some extra help to determine
      * if it is uninitialized*/
-    got_product = 0;
-    got_vendor = 0;
+    got_product = false;
+    got_vendor = false;
 
     cur = node->children;
     while (cur != NULL) {
@@ -3507,7 +3507,7 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node,
                 char *vendor = virXMLPropString(cur, "id");
 
                 if (vendor) {
-                    got_vendor = 1;
+                    got_vendor = true;
                     if (virStrToLong_ui(vendor, NULL, 0,
                                     &def->source.subsys.u.usb.vendor) < 0) {
                         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -3525,7 +3525,7 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node,
                 char* product = virXMLPropString(cur, "id");
 
                 if (product) {
-                    got_product = 1;
+                    got_product = true;
                     if (virStrToLong_ui(product, NULL, 0,
                                         &def->source.subsys.u.usb.product) < 0) {
                         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -15244,7 +15244,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 {
     const char *type = virDomainGraphicsTypeToString(def->type);
     const char *listenAddr = NULL;
-    int children = 0;
+    bool children = false;
     int i;
 
     if (!type) {
@@ -15380,7 +15380,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
             continue;
         if (!children) {
             virBufferAddLit(buf, ">\n");
-            children = 1;
+            children = true;
         }
         virDomainGraphicsListenDefFormat(buf, &def->listens[i], flags);
     }
@@ -15393,7 +15393,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 
             if (!children) {
                 virBufferAddLit(buf, ">\n");
-                children = 1;
+                children = true;
             }
 
             virBufferAsprintf(buf, "      <channel name='%s' mode='%s'/>\n",
@@ -15405,7 +15405,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
                           def->data.spice.streaming || def->data.spice.copypaste ||
                           def->data.spice.mousemode)) {
             virBufferAddLit(buf, ">\n");
-            children = 1;
+            children = true;
         }
         if (def->data.spice.image)
             virBufferAsprintf(buf, "      <image compression='%s'/>\n",
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 0eb6703..b2be99a 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -602,12 +602,12 @@ checkValidMask(unsigned char *data, int len)
 {
     uint32_t idx = 0;
     uint8_t mask = 0x80;
-    int checkones = 1;
+    bool checkones = true;
 
     while ((idx >> 3) < len) {
         if (checkones) {
             if (!(data[idx>>3] & mask))
-                checkones = 0;
+                checkones = false;
         } else {
             if ((data[idx>>3] & mask))
                 return false;
@@ -1779,7 +1779,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
     int rc = 0, g_rc = 0;
     int idx = 0;
     char *prop;
-    int found = 0;
+    bool found = false;
     enum attrDatatype datatype, att_datatypes;
     enum virNWFilterEntryItemFlags *flags ,match_flag = 0, flags_set = 0;
     nwItemDesc *item;
@@ -1806,7 +1806,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
         flags_set = match_flag;
 
         if (prop) {
-            found = 0;
+            found = false;
 
             validator = NULL;
 
@@ -1816,7 +1816,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                              item,
                                              &prop[1]) < 0)
                     rc = -1;
-                found = 1;
+                found = true;
             }
 
             datatype = 1;
@@ -1840,7 +1840,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                             if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
                                 if (uint_val <= 0xff) {
                                     item->u.u8 = uint_val;
-                                    found = 1;
+                                    found = true;
                                     data.ui = uint_val;
                                 } else
                                     rc = -1;
@@ -1855,7 +1855,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                             if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
                                 if (uint_val <= 0xffff) {
                                     item->u.u16 = uint_val;
-                                    found = 1;
+                                    found = true;
                                     data.ui = uint_val;
                                 } else
                                     rc = -1;
@@ -1869,7 +1869,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                         case DATATYPE_UINT32:
                             if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
                                 item->u.u32 = uint_val;
-                                found = 1;
+                                found = true;
                                 data.ui = uint_val;
                             } else
                                 rc = -1;
@@ -1878,7 +1878,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                         case DATATYPE_IPADDR:
                             if (virSocketAddrParseIPv4(&item->u.ipaddr, prop) < 0)
                                 rc = -1;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_IPMASK:
@@ -1886,7 +1886,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 if (uint_val <= 32) {
                                     if (!validator)
                                         item->u.u8 = (uint8_t)uint_val;
-                                    found = 1;
+                                    found = true;
                                     data.ui = uint_val;
                                 } else
                                     rc = -1;
@@ -1899,7 +1899,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                         item->u.u8 = int_val;
                                     else
                                         rc = -1;
-                                    found = 1;
+                                    found = true;
                                 }
                             }
                         break;
@@ -1909,7 +1909,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                                 &item->u.macaddr) < 0) {
                                 rc = -1;
                             }
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_MACMASK:
@@ -1919,13 +1919,13 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 rc = -1;
                             }
                             data.v = &item->u.macaddr;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_IPV6ADDR:
                             if (virSocketAddrParseIPv6(&item->u.ipaddr, prop) < 0)
                                 rc = -1;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_IPV6MASK:
@@ -1933,7 +1933,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 if (uint_val <= 128) {
                                     if (!validator)
                                         item->u.u8 = (uint8_t)uint_val;
-                                    found = 1;
+                                    found = true;
                                     data.ui = uint_val;
                                 } else
                                     rc = -1;
@@ -1946,7 +1946,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                         item->u.u8 = int_val;
                                     else
                                         rc = -1;
-                                    found = 1;
+                                    found = true;
                                 }
                             }
                         break;
@@ -1960,7 +1960,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 break;
                             }
                             data.c = prop;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_STRINGCOPY:
@@ -1971,7 +1971,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 break;
                             }
                             data.c = item->u.string;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_BOOLEAN:
@@ -1983,7 +1983,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                                 item->u.boolean = false;
 
                             data.ui = item->u.boolean;
-                            found = 1;
+                            found = true;
                         break;
 
                         case DATATYPE_LAST:
@@ -1994,13 +1994,13 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
 
                 if (rc != 0 && att_datatypes != 0) {
                     rc = 0;
-                    found = 0;
+                    found = false;
                 }
 
                 datatype <<= 1;
             } /* while */
 
-            if (found == 1 && rc == 0) {
+            if (found && rc == 0) {
                 *flags = NWFILTER_ENTRY_ITEM_FLAG_EXISTS | flags_set;
                 item->datatype = datatype >> 1;
                 if (validator) {
@@ -2296,7 +2296,7 @@ virNWFilterRuleParse(xmlNodePtr node)
     char *direction;
     char *prio;
     char *statematch;
-    int found;
+    bool found;
     int found_i = 0;
     int priority;
 
@@ -2357,7 +2357,7 @@ virNWFilterRuleParse(xmlNodePtr node)
 
     cur = node->children;
 
-    found = 0;
+    found = false;
 
     while (cur != NULL) {
         if (cur->type == XML_ELEMENT_NODE) {
@@ -2369,7 +2369,7 @@ virNWFilterRuleParse(xmlNodePtr node)
                 if (xmlStrEqual(cur->name, BAD_CAST virAttr[i].id)) {
 
                     found_i = i;
-                    found = 1;
+                    found = true;
                     ret->prtclType = virAttr[i].prtclType;
 
                     if (virNWFilterRuleDetailsParse(cur,
@@ -3217,8 +3217,8 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
                                 virNWFilterRuleDefPtr def)
 {
     int i = 0, j;
-    bool typeShown = 0;
-    bool neverShown = 1;
+    bool typeShown = false;
+    bool neverShown = true;
     bool asHex;
     enum match {
         MATCH_NONE = 0,
@@ -3235,8 +3235,8 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
         if ((flags & NWFILTER_ENTRY_ITEM_FLAG_EXISTS)) {
             if (!typeShown) {
                 virBufferAsprintf(buf, "    <%s", type);
-                typeShown = 1;
-                neverShown = 0;
+                typeShown = true;
+                neverShown = false;
             }
 
             if ((flags & NWFILTER_ENTRY_ITEM_FLAG_IS_NEG)) {
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index dfe686b..ceb1be4 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1601,7 +1601,7 @@ int main(int argc, char *argv[])
     size_t nveths = 0;
     char **veths = NULL;
     int handshakeFd = -1;
-    int bg = 0;
+    bool bg = false;
     const struct option options[] = {
         { "background", 0, NULL, 'b' },
         { "name",   1, NULL, 'n' },
@@ -1639,7 +1639,7 @@ int main(int argc, char *argv[])
 
         switch (c) {
         case 'b':
-            bg = 1;
+            bg = true;
             break;
 
         case 'n':
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d2485c3..990decb 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -892,12 +892,12 @@ virLXCProcessReadLogOutputData(virDomainObjPtr vm,
 
     while (retries) {
         ssize_t bytes;
-        int isdead = 0;
+        bool isdead = false;
         char *eol;
 
         if (vm->pid <= 0 ||
             (kill(vm->pid, 0) == -1 && errno == ESRCH))
-            isdead = 1;
+            isdead = true;
 
         /* Any failures should be detected before we read the log, so we
          * always have something useful to report on failure. */
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index f906e83..ffb597a 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1928,7 +1928,7 @@ iptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
     int rc;
     int directionIn = 0;
     char chainPrefix[2];
-    int needState = 1;
+    bool needState = true;
     bool maySkipICMP, inout = false;
     const char *matchState;
 
@@ -1947,11 +1947,11 @@ iptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
         directionIn = 1;
         inout = (rule->tt == VIR_NWFILTER_RULE_DIRECTION_INOUT);
         if (inout)
-            needState = 0;
+            needState = false;
     }
 
     if ((rule->flags & RULE_FLAG_NO_STATEMATCH))
-        needState = 0;
+        needState = false;
 
     chainPrefix[0] = 'F';
 
@@ -2701,7 +2701,7 @@ ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
     case VIR_NWFILTER_RULE_PROTOCOL_ICMP:
     case VIR_NWFILTER_RULE_PROTOCOL_IGMP:
     case VIR_NWFILTER_RULE_PROTOCOL_ALL:
-        isIPv6 = 0;
+        isIPv6 = false;
         rc = iptablesCreateRuleInstance(nwfilter,
                                         rule,
                                         ifname,
@@ -2718,7 +2718,7 @@ ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
     case VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6:
     case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6:
     case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6:
-        isIPv6 = 1;
+        isIPv6 = true;
         rc = iptablesCreateRuleInstance(nwfilter,
                                         rule,
                                         ifname,
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 7bca2f4..4180505 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -666,7 +666,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
     int nEntries = 0;
     virNWFilterRuleInstPtr *insts = NULL;
     void **ptrs = NULL;
-    int instantiate = 1;
+    bool instantiate = true;
     char *buf;
     virNWFilterVarValuePtr lv;
     const char *learning;
@@ -753,7 +753,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
         instantiate = *foundNewFilter;
     break;
     case INSTANTIATE_ALWAYS:
-        instantiate = 1;
+        instantiate = true;
     break;
     }
 
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index c7a9681..d7baaa9 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -629,7 +629,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
             events & VIR_EVENT_HANDLE_HANGUP) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("End of file from monitor"));
-            eof = 1;
+            eof = true;
             events &= ~VIR_EVENT_HANDLE_HANGUP;
         }
 
@@ -637,14 +637,14 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
             events & VIR_EVENT_HANDLE_ERROR) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Invalid file descriptor while waiting for monitor"));
-            eof = 1;
+            eof = true;
             events &= ~VIR_EVENT_HANDLE_ERROR;
         }
         if (!error && events) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unhandled event %d for monitor fd %d"),
                            events, mon->fd);
-            error = 1;
+            error = true;
         }
     }
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9f9f306..d99bcc5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -662,8 +662,8 @@ virQEMUCapsInitGuest(virCapsPtr caps,
 {
     virCapsGuestPtr guest;
     int i;
-    int haskvm = 0;
-    int haskqemu = 0;
+    bool haskvm = false;
+    bool haskqemu = false;
     char *kvmbin = NULL;
     char *binary = NULL;
     virCapsGuestMachinePtr *machines = NULL;
@@ -725,11 +725,11 @@ virQEMUCapsInitGuest(virCapsPtr caps,
         (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KVM) ||
          virQEMUCapsGet(qemubinCaps, QEMU_CAPS_ENABLE_KVM) ||
          kvmbin))
-        haskvm = 1;
+        haskvm = true;
 
     if (access("/dev/kqemu", F_OK) == 0 &&
         virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KQEMU))
-        haskqemu = 1;
+        haskqemu = true;
 
     if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines) < 0)
         goto error;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 434f5a7..523db73 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -293,7 +293,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
-        int active, fail = 0;
+        int active;
+        bool fail = false;
         virErrorPtr errobj;
         virNetworkPtr network = virNetworkLookupByName(conn,
                                                        net->data.network.name);
@@ -302,7 +303,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
 
         active = virNetworkIsActive(network);
         if (active != 1) {
-            fail = 1;
+            fail = true;
 
             if (active == 0)
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -313,7 +314,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
         if (!fail) {
             brname = virNetworkGetBridgeName(network);
             if (brname == NULL)
-                fail = 1;
+                fail = true;
         }
 
         /* Make sure any above failure is preserved */
@@ -5813,25 +5814,25 @@ qemuBuildObsoleteAccelArg(virCommandPtr cmd,
                           const virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps)
 {
-    int disableKQEMU = 0;
-    int enableKQEMU = 0;
-    int disableKVM = 0;
-    int enableKVM = 0;
+    bool disableKQEMU = false;
+    bool enableKQEMU = false;
+    bool disableKVM = false;
+    bool enableKVM = false;
 
     switch (def->virtType) {
     case VIR_DOMAIN_VIRT_QEMU:
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
-            disableKQEMU = 1;
+            disableKQEMU = true;
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
-            disableKVM = 1;
+            disableKVM = true;
         break;
 
     case VIR_DOMAIN_VIRT_KQEMU:
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
-            disableKVM = 1;
+            disableKVM = true;
 
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU)) {
-            enableKQEMU = 1;
+            enableKQEMU = true;
         } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("the QEMU binary does not support kqemu"));
@@ -5841,10 +5842,10 @@ qemuBuildObsoleteAccelArg(virCommandPtr cmd,
 
     case VIR_DOMAIN_VIRT_KVM:
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
-            disableKQEMU = 1;
+            disableKQEMU = true;
 
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) {
-            enableKVM = 1;
+            enableKVM = true;
         } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("the QEMU binary does not support kvm"));
@@ -7344,7 +7345,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             char *optstr;
             int bootindex = 0;
             virDomainDiskDefPtr disk = def->disks[i];
-            int withDeviceArg = 0;
+            bool withDeviceArg = false;
             bool deviceFlagMasked = false;
 
             /* Unless we have -device, then USB disks need special
@@ -7388,7 +7389,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                care that we can't use -device */
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
                 if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
-                    withDeviceArg = 1;
+                    withDeviceArg = true;
                 } else {
                     virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
                     deviceFlagMasked = true;
@@ -9234,7 +9235,7 @@ qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt,
     const char *nic;
     int wantvlan = 0;
     const char *tmp;
-    int genmac = 1;
+    bool genmac = true;
     int i;
 
     tmp = strchr(val, ',');
@@ -9325,7 +9326,7 @@ qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt,
 
     for (i = 0; i < nkeywords; i++) {
         if (STREQ(keywords[i], "macaddr")) {
-            genmac = 0;
+            genmac = false;
             if (virMacAddrParse(values[i], &def->mac) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("unable to parse mac address '%s'"),
@@ -9889,7 +9890,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 {
     virDomainDefPtr def;
     int i;
-    int nographics = 0;
+    bool nographics = false;
     bool fullscreen = false;
     char *path;
     int nnics = 0;
@@ -10274,7 +10275,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
         } else if (STREQ(arg, "-enable-kvm")) {
             def->virtType = VIR_DOMAIN_VIRT_KVM;
         } else if (STREQ(arg, "-nographic")) {
-            nographics = 1;
+            nographics = true;
         } else if (STREQ(arg, "-full-screen")) {
             fullscreen = true;
         } else if (STREQ(arg, "-localtime")) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3df26b8..66d4c60 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3257,7 +3257,7 @@ static int qemuDomainCoreDump(virDomainPtr dom,
     virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     qemuDomainObjPrivatePtr priv;
-    int resume = 0, paused = 0;
+    bool resume = false, paused = false;
     int ret = -1;
     virDomainEventPtr event = NULL;
 
@@ -3288,7 +3288,7 @@ static int qemuDomainCoreDump(virDomainPtr dom,
         if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_DUMP,
                                 QEMU_ASYNC_JOB_DUMP) < 0)
             goto endjob;
-        paused = 1;
+        paused = true;
 
         if (!virDomainObjIsActive(vm)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -3301,7 +3301,7 @@ static int qemuDomainCoreDump(virDomainPtr dom,
     if (ret < 0)
         goto endjob;
 
-    paused = 1;
+    paused = true;
 
 endjob:
     if ((ret == 0) && (flags & VIR_DUMP_CRASH)) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 73ced73..43940ea 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3121,7 +3121,7 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
     char *dom_xml = NULL;
     int cookielen = 0, ret;
     virErrorPtr orig_err = NULL;
-    int cancelled;
+    bool cancelled;
     virStreamPtr st = NULL;
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
               "flags=%lx, dname=%s, resource=%lu",
@@ -3178,7 +3178,7 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
         (uri_out == NULL)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("domainMigratePrepare2 did not set uri"));
-        cancelled = 1;
+        cancelled = true;
         goto finish;
     }
 
@@ -3204,7 +3204,7 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
     /* If Perform returns < 0, then we need to cancel the VM
      * startup on the destination
      */
-    cancelled = ret < 0 ? 1 : 0;
+    cancelled = ret < 0;
 
 finish:
     /* In version 2 of the migration protocol, we pass the
@@ -3264,7 +3264,7 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
     int cookieoutlen = 0;
     int ret = -1;
     virErrorPtr orig_err = NULL;
-    int cancelled;
+    bool cancelled;
     virStreamPtr st = NULL;
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, xmlin=%s, "
               "dconnuri=%s, uri=%s, flags=%lx, dname=%s, resource=%lu",
@@ -3315,7 +3315,7 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
         VIR_DEBUG("Offline migration, skipping Perform phase");
         VIR_FREE(cookieout);
         cookieoutlen = 0;
-        cancelled = 0;
+        cancelled = false;
         goto finish;
     }
 
@@ -3323,7 +3323,7 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
         (uri_out == NULL)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("domainMigratePrepare3 did not set uri"));
-        cancelled = 1;
+        cancelled = true;
         goto finish;
     }
 
@@ -3361,7 +3361,7 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
     /* If Perform returns < 0, then we need to cancel the VM
      * startup on the destination
      */
-    cancelled = ret < 0 ? 1 : 0;
+    cancelled = ret < 0;
 
 finish:
     /*
@@ -3391,7 +3391,7 @@ finish:
      * The lock manager plugins should take care of
      * safety in this scenario.
      */
-    cancelled = ddomain == NULL ? 1 : 0;
+    cancelled = ddomain == NULL;
 
     /* If finish3 set an error, and we don't have an earlier
      * one we need to preserve it in case confirm3 overwrites
@@ -3869,7 +3869,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
 {
     virDomainPtr dom = NULL;
     virDomainEventPtr event = NULL;
-    int newVM = 1;
+    bool newVM = true;
     qemuMigrationCookiePtr mig = NULL;
     virErrorPtr orig_err = NULL;
     int cookie_flags = 0;
@@ -3932,7 +3932,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
         if (flags & VIR_MIGRATE_PERSIST_DEST) {
             virDomainDefPtr vmdef;
             if (vm->persistent)
-                newVM = 0;
+                newVM = false;
             vm->persistent = 1;
             if (mig->persistent)
                 vm->newDef = vmdef = mig->persistent;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 4e35f79..d65bdeb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -608,7 +608,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
             events & VIR_EVENT_HANDLE_HANGUP) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("End of file from monitor"));
-            eof = 1;
+            eof = true;
             events &= ~VIR_EVENT_HANDLE_HANGUP;
         }
 
@@ -616,14 +616,14 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
             events & VIR_EVENT_HANDLE_ERROR) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Invalid file descriptor while waiting for monitor"));
-            eof = 1;
+            eof = true;
             events &= ~VIR_EVENT_HANDLE_ERROR;
         }
         if (!error && events) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unhandled event %d for monitor fd %d"),
                            events, mon->fd);
-            error = 1;
+            error = true;
         }
     }
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 2b73884..8b9db7f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1599,7 +1599,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
 {
     int ret;
     int i;
-    int found = 0;
+    bool found = false;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-blockstats",
                                                      NULL);
     virJSONValuePtr reply = NULL;
@@ -1661,7 +1661,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
         if (STRNEQ(thisdev, dev_name))
             continue;
 
-        found = 1;
+        found = true;
         if ((stats = virJSONValueObjectGet(dev, "stats")) == NULL ||
             stats->type != VIR_JSON_TYPE_OBJECT) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1823,7 +1823,7 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
 {
     int ret = -1;
     int i;
-    int found = 0;
+    bool found = false;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-blockstats",
                                                      NULL);
     virJSONValuePtr reply = NULL;
@@ -1876,7 +1876,7 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
         if (STRNEQ(thisdev, dev_name))
             continue;
 
-        found = 1;
+        found = true;
         if ((parent = virJSONValueObjectGet(dev, "parent")) == NULL ||
             parent->type != VIR_JSON_TYPE_OBJECT) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index d4ee93d..ef093b5 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1906,7 +1906,7 @@ int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
     char *cmd = NULL;
     char *reply = NULL;
     char *safe_path = NULL;
-    int tryOldSyntax = 0;
+    bool tryOldSyntax = false;
     int ret = -1;
 
     safe_path = qemuMonitorEscapeArg(path);
@@ -1929,7 +1929,7 @@ try_command:
         if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
             VIR_FREE(reply);
             VIR_FREE(cmd);
-            tryOldSyntax = 1;
+            tryOldSyntax = true;
             goto try_command;
         }
 
@@ -1984,7 +1984,7 @@ int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
 {
     char *cmd = NULL;
     char *reply = NULL;
-    int tryOldSyntax = 0;
+    bool tryOldSyntax = false;
     int ret = -1;
 
 try_command:
@@ -2010,7 +2010,7 @@ try_command:
      * need to try the old syntax */
     if (!tryOldSyntax &&
         strstr(reply, "extraneous characters")) {
-        tryOldSyntax = 1;
+        tryOldSyntax = true;
         VIR_FREE(reply);
         VIR_FREE(cmd);
         goto try_command;
@@ -2306,7 +2306,7 @@ int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
 {
     char *cmd = NULL;
     char *reply = NULL;
-    int tryOldSyntax = 0;
+    bool tryOldSyntax = false;
     int ret = -1;
 
 try_command:
@@ -2323,7 +2323,7 @@ try_command:
         if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
             VIR_FREE(reply);
             VIR_FREE(cmd);
-            tryOldSyntax = 1;
+            tryOldSyntax = true;
             goto try_command;
         }
 
@@ -2395,7 +2395,7 @@ int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
     char *safe_str;
-    int tryOldSyntax = 0;
+    bool tryOldSyntax = false;
 
     safe_str = qemuMonitorEscapeArg(drivestr);
     if (!safe_str) {
@@ -2425,7 +2425,7 @@ try_command:
         if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
             VIR_FREE(reply);
             VIR_FREE(cmd);
-            tryOldSyntax = 1;
+            tryOldSyntax = true;
             goto try_command;
         }
         virReportError(VIR_ERR_OPERATION_FAILED,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f71968f..191c9c2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1404,12 +1404,11 @@ qemuProcessReadLogOutput(virDomainObjPtr vm,
 
     while (retries) {
         ssize_t func_ret;
-        int isdead = 0;
+        bool isdead;
 
         func_ret = func(vm, buf, fd);
 
-        if (kill(vm->pid, 0) == -1 && errno == ESRCH)
-            isdead = 1;
+        isdead = kill(vm->pid, 0) == -1 && errno == ESRCH;
 
         got = qemuProcessReadLog(fd, buf, buflen, got);
         if (got < 0) {
@@ -2071,23 +2070,22 @@ qemuProcessAssignNextPCIAddress(virDomainDeviceInfo *info,
                                 qemuMonitorPCIAddress *addrs,
                                 int naddrs)
 {
-    int found = 0;
+    bool found = false;
     int i;
 
     VIR_DEBUG("Look for %x:%x out of %d", vendor, product, naddrs);
 
-    for (i = 0; (i < naddrs) && !found; i++) {
+    for (i = 0; i < naddrs; i++) {
         VIR_DEBUG("Maybe %x:%x", addrs[i].vendor, addrs[i].product);
         if (addrs[i].vendor == vendor &&
             addrs[i].product == product) {
             VIR_DEBUG("Match %d", i);
-            found = 1;
+            found = true;
             break;
         }
     }
-    if (!found) {
+    if (!found)
         return -1;
-    }
 
     /* Blank it out so this device isn't matched again */
     addrs[i].vendor = 0;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2cda559..fcf45d3 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1134,7 +1134,7 @@ done:
 static int remoteConnectIsEncrypted(virConnectPtr conn)
 {
     int rv = -1;
-    int encrypted = 0;
+    bool encrypted;
     struct private_data *priv = conn->privateData;
     remote_connect_is_secure_ret ret;
     remoteDriverLock(priv);
@@ -1145,8 +1145,7 @@ static int remoteConnectIsEncrypted(virConnectPtr conn)
              (xdrproc_t) xdr_remote_connect_is_secure_ret, (char *) &ret) == -1)
         goto done;
 
-    if (virNetClientIsEncrypted(priv->client))
-        encrypted = 1;
+    encrypted = virNetClientIsEncrypted(priv->client);
 
     /* We claim to be encrypted, if the remote driver
      * transport itself is encrypted, and the remote
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index a54f395..9f56b03 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1059,7 +1059,7 @@ void virNetServerUpdateServices(virNetServerPtr srv,
 void virNetServerRun(virNetServerPtr srv)
 {
     int timerid = -1;
-    int timerActive = 0;
+    bool timerActive = false;
     int i;
 
     virObjectLock(srv);
@@ -1090,14 +1090,14 @@ void virNetServerRun(virNetServerPtr srv)
                 if (srv->clients) {
                     VIR_DEBUG("Deactivating shutdown timer %d", timerid);
                     virEventUpdateTimeout(timerid, -1);
-                    timerActive = 0;
+                    timerActive = false;
                 }
             } else {
                 if (!srv->clients) {
                     VIR_DEBUG("Activating shutdown timer %d", timerid);
                     virEventUpdateTimeout(timerid,
                                           srv->autoShutdownTimeout * 1000);
-                    timerActive = 1;
+                    timerActive = true;
                 }
             }
         }
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 66b3ff7..44f6fa9 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -535,7 +535,7 @@ static int virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
     struct stat st;
     gid_t gid;
     uid_t uid;
-    int filecreated = 0;
+    bool filecreated = false;
 
     if ((pool->def->type == VIR_STORAGE_POOL_NETFS)
         && (((getuid() == 0)
@@ -550,7 +550,7 @@ static int virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
         if (virCommandRun(cmd, NULL) == 0) {
             /* command was successfully run, check if the file was created */
             if (stat(vol->target.path, &st) >=0)
-                filecreated = 1;
+                filecreated = true;
         }
     }
 
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 51f25f0..1fc09bf 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2315,7 +2315,7 @@ int virCgroupGetFreezerState(virCgroupPtr group, char **state)
 static int virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
 {
     int rc;
-    int killedAny = 0;
+    bool killedAny = false;
     char *keypath = NULL;
     bool done = false;
     FILE *fp = NULL;
@@ -2359,7 +2359,7 @@ static int virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr
                     }
                     /* Leave RC == 0 since we didn't kill one */
                 } else {
-                    killedAny = 1;
+                    killedAny = true;
                     done = false;
                 }
 
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 348bddc..8914011 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -366,7 +366,8 @@ virLogStr(const char *str)
 static void
 virLogDumpAllFD(const char *msg, int len)
 {
-    int i, found = 0;
+    int i;
+    bool found = false;
 
     if (len <= 0)
         len = strlen(msg);
@@ -377,7 +378,7 @@ virLogDumpAllFD(const char *msg, int len)
 
             if (fd >= 0) {
                 ignore_value(safewrite(fd, msg, len));
-                found = 1;
+                found = true;
             }
         }
     }
@@ -806,7 +807,7 @@ virLogVMessage(virLogSource source,
     char timestamp[VIR_TIME_STRING_BUFLEN];
     int fprio, i, ret;
     int saved_errno = errno;
-    int emit = 1;
+    bool emit = true;
     unsigned int filterflags = 0;
 
     if (virLogInitialize() < 0)
@@ -821,12 +822,12 @@ virLogVMessage(virLogSource source,
     fprio = virLogFiltersCheck(filename, &filterflags);
     if (fprio == 0) {
         if (priority < virLogDefaultPriority)
-            emit = 0;
+            emit = false;
     } else if (priority < fprio) {
-        emit = 0;
+        emit = false;
     }
 
-    if ((emit == 0) && ((virLogBuffer == NULL) || (virLogSize <= 0)))
+    if (!emit && ((virLogBuffer == NULL) || (virLogSize <= 0)))
         goto cleanup;
 
     /*
@@ -856,7 +857,7 @@ virLogVMessage(virLogSource source,
     virLogStr(": ");
     virLogStr(msg);
     virLogUnlock();
-    if (emit == 0)
+    if (!emit)
         goto cleanup;
 
     virLogLock();
diff --git a/src/util/virpci.c b/src/util/virpci.c
index cdc33c9..1346ec1 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -884,7 +884,7 @@ static int
 virPCIProbeStubDriver(const char *driver)
 {
     char *drvpath = NULL;
-    int probed = 0;
+    bool probed = false;
 
 recheck:
     if (virPCIDriverDir(&drvpath, driver) == 0 && virFileExists(drvpath)) {
@@ -897,7 +897,7 @@ recheck:
 
     if (!probed) {
         const char *const probecmd[] = { MODPROBE, driver, NULL };
-        probed = 1;
+        probed = true;
         if (virRun(probecmd, NULL) < 0) {
             char ebuf[1024];
             VIR_WARN("failed to load driver %s: %s", driver,
@@ -1276,7 +1276,7 @@ virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher)
     char *tmp;
     unsigned long long start, end;
     unsigned int domain, bus, slot, function;
-    int in_matching_device;
+    bool in_matching_device;
     int ret;
     size_t match_depth;
 
@@ -1291,7 +1291,7 @@ virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher)
     }
 
     ret = 0;
-    in_matching_device = 0;
+    in_matching_device = false;
     match_depth = 0;
     while (fgets(line, sizeof(line), fp) != 0) {
         /* the logic here is a bit confusing.  For each line, we look to
@@ -1317,7 +1317,7 @@ virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher)
             }
         }
         else {
-            in_matching_device = 0;
+            in_matching_device = false;
 
             /* expected format: <start>-<end> : <domain>:<bus>:<slot>.<function> */
             if (/* start */
@@ -1338,7 +1338,7 @@ virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher)
             if (domain != dev->domain || bus != dev->bus || slot != dev->slot ||
                 function != dev->function)
                 continue;
-            in_matching_device = 1;
+            in_matching_device = true;
             match_depth = strspn(line, " ");
         }
     }
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 3b03023..9cdb134 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -280,14 +280,15 @@ cleanup:
 char *virURIFormatParams(virURIPtr uri)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    int i, amp = 0;
+    int i;
+    bool amp = false;
 
     for (i = 0; i < uri->paramsCount; ++i) {
         if (!uri->params[i].ignore) {
             if (amp) virBufferAddChar(&buf, '&');
             virBufferStrcat(&buf, uri->params[i].name, "=", NULL);
             virBufferURIEncodeString(&buf, uri->params[i].value);
-            amp = 1;
+            amp = true;
         }
     }
 
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 028f1d1..ac26545 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -136,16 +136,16 @@ virPipeReadUntilEOF(int outfd, int errfd,
 
     struct pollfd fds[2];
     int i;
-    int finished[2];
+    bool finished[2];
 
     fds[0].fd = outfd;
     fds[0].events = POLLIN;
     fds[0].revents = 0;
-    finished[0] = 0;
+    finished[0] = false;
     fds[1].fd = errfd;
     fds[1].events = POLLIN;
     fds[1].revents = 0;
-    finished[1] = 0;
+    finished[1] = false;
 
     while (!(finished[0] && finished[1])) {
 
@@ -162,7 +162,7 @@ virPipeReadUntilEOF(int outfd, int errfd,
             if (!(fds[i].revents))
                 continue;
             else if (fds[i].revents & POLLHUP)
-                finished[i] = 1;
+                finished[i] = true;
 
             if (!(fds[i].revents & POLLIN)) {
                 if (fds[i].revents & POLLHUP)
@@ -176,10 +176,10 @@ virPipeReadUntilEOF(int outfd, int errfd,
             got = read(fds[i].fd, data, sizeof(data));
 
             if (got == sizeof(data))
-                finished[i] = 0;
+                finished[i] = false;
 
             if (got == 0) {
-                finished[i] = 1;
+                finished[i] = true;
                 continue;
             }
             if (got < 0) {
diff --git a/tests/reconnect.c b/tests/reconnect.c
index 4031360..b446161 100644
--- a/tests/reconnect.c
+++ b/tests/reconnect.c
@@ -16,7 +16,7 @@ static int
 mymain(void)
 {
     int id = 0;
-    int ro = 0;
+    bool ro = false;
     virConnectPtr conn;
     virDomainPtr dom;
     int status;
@@ -40,7 +40,7 @@ mymain(void)
 
     conn = virConnectOpen(NULL);
     if (conn == NULL) {
-        ro = 1;
+        ro = true;
         conn = virConnectOpenReadOnly(NULL);
     }
     if (conn == NULL) {
@@ -54,7 +54,7 @@ mymain(void)
     }
     virDomainFree(dom);
     virConnectClose(conn);
-    if (ro == 1)
+    if (ro)
         conn = virConnectOpenReadOnly(NULL);
     else
         conn = virConnectOpen(NULL);
diff --git a/tests/ssh.c b/tests/ssh.c
index 48009a4..56b2e9b 100644
--- a/tests/ssh.c
+++ b/tests/ssh.c
@@ -29,14 +29,14 @@
 int main(int argc, char **argv)
 {
     int i;
-    int failConnect = 0; /* Exit -1, with no data on stdout, msg on stderr */
-    int dieEarly = 0;    /* Exit -1, with partial data on stdout, msg on stderr */
+    bool failConnect = false; /* Exit -1, with no data on stdout, msg on stderr */
+    bool dieEarly = false;    /* Exit -1, with partial data on stdout, msg on stderr */
 
     for (i = 1; i < argc; i++) {
         if (STREQ(argv[i], "nosuchhost"))
-            failConnect = 1;
+            failConnect = true;
         else if (STREQ(argv[i], "crashinghost"))
-            dieEarly = 1;
+            dieEarly = true;
     }
 
     if (failConnect) {
-- 
1.8.1.5




More information about the libvir-list mailing list