summaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-05-15 16:25:00 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-06-22 17:40:00 +0200
commit34acbc95229f9f841bde83691a5af949c15e105b (patch)
tree10da2a91f4d06bae34b637df4f1997c8b54ed23d /hmp.c
parentfc48ffc39ed1060856475e4320d5896f26c945e8 (diff)
qobject: Use 'bool' inside qdict
Now that qbool is fixed, let's fix getting and setting a bool value to a qdict member to also use C99 bool rather than int. I audited all callers to ensure that the changed return type will not cause any changed semantics. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/hmp.c b/hmp.c
index 23abc7d9f1..458a0c933d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -438,8 +438,8 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
BlockInfoList *block_list, *info;
BlockDeviceInfoList *blockdev_list, *blockdev;
const char *device = qdict_get_try_str(qdict, "device");
- bool verbose = qdict_get_try_bool(qdict, "verbose", 0);
- bool nodes = qdict_get_try_bool(qdict, "nodes", 0);
+ bool verbose = qdict_get_try_bool(qdict, "verbose", false);
+ bool nodes = qdict_get_try_bool(qdict, "nodes", false);
bool printed = false;
/* Print BlockBackend information */
@@ -995,7 +995,7 @@ void hmp_nmi(Monitor *mon, const QDict *qdict)
void hmp_set_link(Monitor *mon, const QDict *qdict)
{
const char *name = qdict_get_str(qdict, "name");
- int up = qdict_get_bool(qdict, "up");
+ bool up = qdict_get_bool(qdict, "up");
Error *err = NULL;
qmp_set_link(name, up, &err);
@@ -1039,8 +1039,8 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
const char *device = qdict_get_str(qdict, "device");
const char *filename = qdict_get_str(qdict, "target");
const char *format = qdict_get_try_str(qdict, "format");
- int reuse = qdict_get_try_bool(qdict, "reuse", 0);
- int full = qdict_get_try_bool(qdict, "full", 0);
+ bool reuse = qdict_get_try_bool(qdict, "reuse", false);
+ bool full = qdict_get_try_bool(qdict, "full", false);
enum NewImageMode mode;
Error *err = NULL;
@@ -1069,8 +1069,8 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
const char *device = qdict_get_str(qdict, "device");
const char *filename = qdict_get_str(qdict, "target");
const char *format = qdict_get_try_str(qdict, "format");
- int reuse = qdict_get_try_bool(qdict, "reuse", 0);
- int full = qdict_get_try_bool(qdict, "full", 0);
+ bool reuse = qdict_get_try_bool(qdict, "reuse", false);
+ bool full = qdict_get_try_bool(qdict, "full", false);
enum NewImageMode mode;
Error *err = NULL;
@@ -1098,7 +1098,7 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
const char *device = qdict_get_str(qdict, "device");
const char *filename = qdict_get_try_str(qdict, "snapshot-file");
const char *format = qdict_get_try_str(qdict, "format");
- int reuse = qdict_get_try_bool(qdict, "reuse", 0);
+ bool reuse = qdict_get_try_bool(qdict, "reuse", false);
enum NewImageMode mode;
Error *err = NULL;
@@ -1294,7 +1294,7 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict)
void hmp_eject(Monitor *mon, const QDict *qdict)
{
- int force = qdict_get_try_bool(qdict, "force", 0);
+ bool force = qdict_get_try_bool(qdict, "force", false);
const char *device = qdict_get_str(qdict, "device");
Error *err = NULL;
@@ -1394,7 +1394,7 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qdict)
{
Error *error = NULL;
const char *device = qdict_get_str(qdict, "device");
- bool force = qdict_get_try_bool(qdict, "force", 0);
+ bool force = qdict_get_try_bool(qdict, "force", false);
qmp_block_job_cancel(device, true, force, &error);
@@ -1474,9 +1474,9 @@ static void hmp_migrate_status_cb(void *opaque)
void hmp_migrate(Monitor *mon, const QDict *qdict)
{
- int detach = qdict_get_try_bool(qdict, "detach", 0);
- int blk = qdict_get_try_bool(qdict, "blk", 0);
- int inc = qdict_get_try_bool(qdict, "inc", 0);
+ bool detach = qdict_get_try_bool(qdict, "detach", false);
+ bool blk = qdict_get_try_bool(qdict, "blk", false);
+ bool inc = qdict_get_try_bool(qdict, "inc", false);
const char *uri = qdict_get_str(qdict, "uri");
Error *err = NULL;
@@ -1522,10 +1522,10 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
- int paging = qdict_get_try_bool(qdict, "paging", 0);
- int zlib = qdict_get_try_bool(qdict, "zlib", 0);
- int lzo = qdict_get_try_bool(qdict, "lzo", 0);
- int snappy = qdict_get_try_bool(qdict, "snappy", 0);
+ bool paging = qdict_get_try_bool(qdict, "paging", false);
+ bool zlib = qdict_get_try_bool(qdict, "zlib", false);
+ bool lzo = qdict_get_try_bool(qdict, "lzo", false);
+ bool snappy = qdict_get_try_bool(qdict, "snappy", false);
const char *file = qdict_get_str(qdict, "filename");
bool has_begin = qdict_haskey(qdict, "begin");
bool has_length = qdict_haskey(qdict, "length");
@@ -1751,8 +1751,8 @@ void hmp_screendump(Monitor *mon, const QDict *qdict)
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
{
const char *uri = qdict_get_str(qdict, "uri");
- int writable = qdict_get_try_bool(qdict, "writable", 0);
- int all = qdict_get_try_bool(qdict, "all", 0);
+ bool writable = qdict_get_try_bool(qdict, "writable", false);
+ bool all = qdict_get_try_bool(qdict, "all", false);
Error *local_err = NULL;
BlockInfoList *block_list, *info;
SocketAddress *addr;
@@ -1805,7 +1805,7 @@ exit:
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_str(qdict, "device");
- int writable = qdict_get_try_bool(qdict, "writable", 0);
+ bool writable = qdict_get_try_bool(qdict, "writable", false);
Error *local_err = NULL;
qmp_nbd_server_add(device, true, writable, &local_err);