diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2010-02-08 17:01:27 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-02-10 13:46:17 -0600 |
commit | 668e3cac4fdba1137798c4453e018070b099679e (patch) | |
tree | 27fb327c53a5b4c458806fbd329118ceb4120739 | |
parent | 06b1297017415ae6a07a0e97ad7d8e90b2d95823 (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>
-rw-r--r-- | qjson.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; } |