aboutsummaryrefslogtreecommitdiffstats
path: root/qjson.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-02-08 17:01:27 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-02-10 13:46:17 -0600
commit668e3cac4fdba1137798c4453e018070b099679e (patch)
tree27fb327c53a5b4c458806fbd329118ceb4120739 /qjson.c
parent06b1297017415ae6a07a0e97ad7d8e90b2d95823 (diff)
qjson: Improve debugging
Add an assert() to qobject_from_jsonf() to assure that the returned QObject is not NULL. Currently this is duplicated in the callers. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qjson.c')
-rw-r--r--qjson.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/qjson.c b/qjson.c
index 9ad8a9120..483c6675d 100644
--- a/qjson.c
+++ b/qjson.c
@@ -53,6 +53,10 @@ QObject *qobject_from_json(const char *string)
return qobject_from_jsonv(string, NULL);
}
+/*
+ * IMPORTANT: This function aborts on error, thus it must not
+ * be used with untrusted arguments.
+ */
QObject *qobject_from_jsonf(const char *string, ...)
{
QObject *obj;
@@ -62,6 +66,7 @@ QObject *qobject_from_jsonf(const char *string, ...)
obj = qobject_from_jsonv(string, &ap);
va_end(ap);
+ assert(obj != NULL);
return obj;
}