mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
maint: forbid 'int foo = true'
I noticed this while working on qemuDomainGetBlockInfo. Assigning a bool value to an int variable compiles fine, but raises red flags on the maintenance front as it becomes too easy to assign -1 or 2 or any other non-bool value to the same variable. * cfg.mk (sc_prohibit_int_assign_bool): New rule. * src/conf/snapshot_conf.c (virDomainSnapshotRedefinePrep): Fix offenders. * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo) (qemuDomainSnapshotCreateXML): Likewise. * src/test/test_driver.c (testDomainSnapshotAlignDisks): Likewise. * src/util/vircgroup.c (virCgroupSupportsCpuBW): Likewise. * src/util/virpci.c (virPCIDeviceBindToStub): Likewise. * src/util/virutil.c (virIsCapableVport): Likewise. * tools/virsh-domain-monitor.c (cmdDomMemStat): Likewise. * tools/virsh-domain.c (cmdBlockResize, cmdScreenshot) (cmdInjectNMI, cmdSendKey, cmdSendProcessSignal) (cmdDetachInterface): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
@@ -298,7 +298,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
||||
virDomainMemoryStatStruct stats[VIR_DOMAIN_MEMORY_STAT_NR];
|
||||
unsigned int nr_stats;
|
||||
size_t i;
|
||||
int ret = false;
|
||||
bool ret = false;
|
||||
int rv = 0;
|
||||
int period = -1;
|
||||
bool config = vshCommandOptBool(cmd, "config");
|
||||
|
||||
@@ -2640,7 +2640,7 @@ cmdBlockResize(vshControl *ctl, const vshCmd *cmd)
|
||||
const char *path = NULL;
|
||||
unsigned long long size = 0;
|
||||
unsigned int flags = 0;
|
||||
int ret = false;
|
||||
bool ret = false;
|
||||
|
||||
if (vshCommandOptStringReq(ctl, cmd, "path", (const char **) &path) < 0)
|
||||
return false;
|
||||
@@ -5163,7 +5163,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
|
||||
virStreamPtr st = NULL;
|
||||
unsigned int screen = 0;
|
||||
unsigned int flags = 0; /* currently unused */
|
||||
int ret = false;
|
||||
bool ret = false;
|
||||
bool created = false;
|
||||
bool generated = false;
|
||||
char *mime = NULL;
|
||||
@@ -7615,7 +7615,7 @@ static bool
|
||||
cmdInjectNMI(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
int ret = true;
|
||||
bool ret = true;
|
||||
|
||||
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
||||
return false;
|
||||
@@ -7678,7 +7678,7 @@ static bool
|
||||
cmdSendKey(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
int ret = false;
|
||||
bool ret = false;
|
||||
const char *codeset_option;
|
||||
int codeset;
|
||||
unsigned int holdtime = 0;
|
||||
@@ -7809,7 +7809,7 @@ static bool
|
||||
cmdSendProcessSignal(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
int ret = false;
|
||||
bool ret = false;
|
||||
const char *pidstr;
|
||||
const char *signame;
|
||||
long long pid_value;
|
||||
@@ -10592,7 +10592,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
|
||||
int diff_mac;
|
||||
size_t i;
|
||||
int ret;
|
||||
int functionReturn = false;
|
||||
bool functionReturn = false;
|
||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
bool current = vshCommandOptBool(cmd, "current");
|
||||
bool config = vshCommandOptBool(cmd, "config");
|
||||
|
||||
Reference in New Issue
Block a user