[Qemu-devel] [PATCH 10/24] qjson: Abort earlier on qobject_from_jsonf() misuse

Markus Armbruster posted 24 patches 8 years, 11 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 10/24] qjson: Abort earlier on qobject_from_jsonf() misuse
Posted by Markus Armbruster 8 years, 11 months ago
Ignoring errors first, then asserting success is suboptimal.  Pass
&error_abort instead, so we abort earlier, and hopefully get more
useful clues on what's wrong.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qobject/qjson.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qobject/qjson.c b/qobject/qjson.c
index 339c9f7..c98d6a7 100644
--- a/qobject/qjson.c
+++ b/qobject/qjson.c
@@ -65,7 +65,7 @@ QObject *qobject_from_jsonf(const char *string, ...)
     va_list ap;
 
     va_start(ap, string);
-    obj = qobject_from_jsonv(string, &ap, NULL);
+    obj = qobject_from_jsonv(string, &ap, &error_abort);
     va_end(ap);
 
     assert(obj != NULL);
-- 
2.7.4


Re: [Qemu-devel] [PATCH 10/24] qjson: Abort earlier on qobject_from_jsonf() misuse
Posted by Kevin Wolf 8 years, 11 months ago
Am 27.02.2017 um 12:20 hat Markus Armbruster geschrieben:
> Ignoring errors first, then asserting success is suboptimal.  Pass
> &error_abort instead, so we abort earlier, and hopefully get more
> useful clues on what's wrong.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>