From c749554a75c05c1ddc65cfb69d492c636122c108 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Tue, 13 Feb 2018 17:16:50 -0500
Subject: [PATCH] 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.

Backports commit 34acbc95229f9f841bde83691a5af949c15e105b from qemu
---
 qemu/include/qapi/qmp/qdict.h | 4 ++--
 qemu/qobject/qdict.c          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/qemu/include/qapi/qmp/qdict.h b/qemu/include/qapi/qmp/qdict.h
index 567c02f4..9e8d3df5 100644
--- a/qemu/include/qapi/qmp/qdict.h
+++ b/qemu/include/qapi/qmp/qdict.h
@@ -55,13 +55,13 @@ const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry);
 /* High level helpers */
 double qdict_get_double(const QDict *qdict, const char *key);
 int64_t qdict_get_int(const QDict *qdict, const char *key);
-int qdict_get_bool(const QDict *qdict, const char *key);
+bool qdict_get_bool(const QDict *qdict, const char *key);
 QList *qdict_get_qlist(const QDict *qdict, const char *key);
 QDict *qdict_get_qdict(const QDict *qdict, const char *key);
 const char *qdict_get_str(const QDict *qdict, const char *key);
 int64_t qdict_get_try_int(const QDict *qdict, const char *key,
                           int64_t def_value);
-int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value);
+bool qdict_get_try_bool(const QDict *qdict, const char *key, int def_value);
 const char *qdict_get_try_str(const QDict *qdict, const char *key);
 
 QDict *qdict_clone_shallow(const QDict *src);
diff --git a/qemu/qobject/qdict.c b/qemu/qobject/qdict.c
index 6f0effe1..4bf1973f 100644
--- a/qemu/qobject/qdict.c
+++ b/qemu/qobject/qdict.c
@@ -241,7 +241,7 @@ int64_t qdict_get_int(const QDict *qdict, const char *key)
  *
  * Return bool mapped by 'key'.
  */
-int qdict_get_bool(const QDict *qdict, const char *key)
+bool qdict_get_bool(const QDict *qdict, const char *key)
 {
     QObject *obj = qdict_get_obj(qdict, key, QTYPE_QBOOL);
     return qbool_get_bool(qobject_to_qbool(obj));
@@ -314,7 +314,7 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
  * dictionary or if the stored object is not of QBool type
  * 'def_value' will be returned.
  */
-int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value)
+bool qdict_get_try_bool(const QDict *qdict, const char *key, int def_value)
 {
     QObject *obj;