qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH for-2.12 1/3] qapi: Add qdict_is_null()
Date: Fri, 10 Nov 2017 23:13:27 +0100	[thread overview]
Message-ID: <20171110221329.24176-2-mreitz@redhat.com> (raw)
In-Reply-To: <20171110221329.24176-1-mreitz@redhat.com>

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 include/qapi/qmp/qdict.h |  1 +
 qobject/qdict.c          | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
index fc218e7be6..c65ebfc748 100644
--- a/include/qapi/qmp/qdict.h
+++ b/include/qapi/qmp/qdict.h
@@ -76,6 +76,7 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
                           int64_t def_value);
 bool qdict_get_try_bool(const QDict *qdict, const char *key, bool def_value);
 const char *qdict_get_try_str(const QDict *qdict, const char *key);
+bool qdict_is_qnull(const QDict *qdict, const char *key);
 
 void qdict_copy_default(QDict *dst, QDict *src, const char *key);
 void qdict_set_default_str(QDict *dst, const char *key, const char *val);
diff --git a/qobject/qdict.c b/qobject/qdict.c
index e8f15f1132..a032ea629a 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -294,6 +294,16 @@ const char *qdict_get_try_str(const QDict *qdict, const char *key)
 }
 
 /**
+ * qdict_is_qnull(): Return true if the value for 'key' is QNull
+ */
+bool qdict_is_qnull(const QDict *qdict, const char *key)
+{
+    QObject *value = qdict_get(qdict, key);
+
+    return value && value->type == QTYPE_QNULL;
+}
+
+/**
  * qdict_iter(): Iterate over all the dictionary's stored values.
  *
  * This function allows the user to provide an iterator, which will be
-- 
2.13.6

  reply	other threads:[~2017-11-10 22:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 22:13 [Qemu-devel] [PATCH for-2.12 0/3] block: Handle null backing link Max Reitz
2017-11-10 22:13 ` Max Reitz [this message]
2017-11-10 22:19   ` [Qemu-devel] [PATCH for-2.12 1/3] qapi: Add qdict_is_null() Eric Blake
2017-11-14 14:07   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2017-11-14 14:15     ` Max Reitz
2017-11-14 14:57   ` [Qemu-devel] " Markus Armbruster
2017-11-14 14:59     ` Max Reitz
2017-11-15  6:51       ` Markus Armbruster
2017-11-10 22:13 ` [Qemu-devel] [PATCH for-2.12 2/3] block: Handle null backing link Max Reitz
2017-11-10 22:22   ` Eric Blake
2017-11-10 22:26     ` Max Reitz
2017-11-14 14:06   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2017-11-14 15:17   ` [Qemu-devel] " Markus Armbruster
2017-11-14 15:19     ` Max Reitz
2017-11-10 22:13 ` [Qemu-devel] [PATCH for-2.12 3/3] block: Deprecate "backing": "" Max Reitz
2017-11-10 22:21   ` Eric Blake
2017-11-13 10:25     ` Daniel P. Berrange
2017-11-14 15:19   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171110221329.24176-2-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).