提交 ba144141 编写于 作者: L Luiz Capitulino 提交者: Anthony Liguori

Monitor: remove unneeded checks

It's not needed to check the return of qobject_from_jsonf()
anymore, as an assert() has been added there.
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 668e3cac
...@@ -1301,7 +1301,6 @@ void bdrv_info(Monitor *mon, QObject **ret_data) ...@@ -1301,7 +1301,6 @@ void bdrv_info(Monitor *mon, QObject **ret_data)
"'removable': %i, 'locked': %i }", "'removable': %i, 'locked': %i }",
bs->device_name, type, bs->removable, bs->device_name, type, bs->removable,
bs->locked); bs->locked);
assert(bs_obj != NULL);
if (bs->drv) { if (bs->drv) {
QObject *obj; QObject *obj;
...@@ -1312,7 +1311,6 @@ void bdrv_info(Monitor *mon, QObject **ret_data) ...@@ -1312,7 +1311,6 @@ void bdrv_info(Monitor *mon, QObject **ret_data)
bs->filename, bs->read_only, bs->filename, bs->read_only,
bs->drv->format_name, bs->drv->format_name,
bdrv_is_encrypted(bs)); bdrv_is_encrypted(bs));
assert(obj != NULL);
if (bs->backing_file[0] != '\0') { if (bs->backing_file[0] != '\0') {
QDict *qdict = qobject_to_qdict(obj); QDict *qdict = qobject_to_qdict(obj);
qdict_put(qdict, "backing_file", qdict_put(qdict, "backing_file",
...@@ -1398,7 +1396,6 @@ void bdrv_info_stats(Monitor *mon, QObject **ret_data) ...@@ -1398,7 +1396,6 @@ void bdrv_info_stats(Monitor *mon, QObject **ret_data)
bs->device_name, bs->device_name,
bs->rd_bytes, bs->wr_bytes, bs->rd_bytes, bs->wr_bytes,
bs->rd_ops, bs->wr_ops); bs->rd_ops, bs->wr_ops);
assert(obj != NULL);
qlist_append_obj(devices, obj); qlist_append_obj(devices, obj);
} }
......
...@@ -285,7 +285,6 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) ...@@ -285,7 +285,6 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, "
"'function': %d }", pci_bus_num(dev->bus), "'function': %d }", pci_bus_num(dev->bus),
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
assert(*ret_data != NULL);
} else } else
monitor_printf(mon, "failed to add %s\n", opts); monitor_printf(mon, "failed to add %s\n", opts);
} }
......
...@@ -183,8 +183,6 @@ static void migrate_put_status(QDict *qdict, const char *name, ...@@ -183,8 +183,6 @@ static void migrate_put_status(QDict *qdict, const char *name,
obj = qobject_from_jsonf("{ 'transferred': %" PRId64 ", " obj = qobject_from_jsonf("{ 'transferred': %" PRId64 ", "
"'remaining': %" PRId64 ", " "'remaining': %" PRId64 ", "
"'total': %" PRId64 " }", trans, rem, total); "'total': %" PRId64 " }", trans, rem, total);
assert(obj != NULL);
qdict_put_obj(qdict, name, obj); qdict_put_obj(qdict, name, obj);
} }
...@@ -258,7 +256,6 @@ void do_info_migrate(Monitor *mon, QObject **ret_data) ...@@ -258,7 +256,6 @@ void do_info_migrate(Monitor *mon, QObject **ret_data)
*ret_data = qobject_from_jsonf("{ 'status': 'cancelled' }"); *ret_data = qobject_from_jsonf("{ 'status': 'cancelled' }");
break; break;
} }
assert(*ret_data != NULL);
} }
} }
......
...@@ -351,8 +351,6 @@ static void timestamp_put(QDict *qdict) ...@@ -351,8 +351,6 @@ static void timestamp_put(QDict *qdict)
obj = qobject_from_jsonf("{ 'seconds': %" PRId64 ", " obj = qobject_from_jsonf("{ 'seconds': %" PRId64 ", "
"'microseconds': %" PRId64 " }", "'microseconds': %" PRId64 " }",
(int64_t) tv.tv_sec, (int64_t) tv.tv_usec); (int64_t) tv.tv_sec, (int64_t) tv.tv_usec);
assert(obj != NULL);
qdict_put_obj(qdict, "timestamp", obj); qdict_put_obj(qdict, "timestamp", obj);
} }
...@@ -900,7 +898,6 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data) ...@@ -900,7 +898,6 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data)
obj = qobject_from_jsonf("{ 'CPU': %d, 'current': %i, 'halted': %i }", obj = qobject_from_jsonf("{ 'CPU': %d, 'current': %i, 'halted': %i }",
env->cpu_index, env == mon->mon_cpu, env->cpu_index, env == mon->mon_cpu,
env->halted); env->halted);
assert(obj != NULL);
cpu = qobject_to_qdict(obj); cpu = qobject_to_qdict(obj);
...@@ -4415,8 +4412,6 @@ static void monitor_control_event(void *opaque, int event) ...@@ -4415,8 +4412,6 @@ static void monitor_control_event(void *opaque, int event)
json_message_parser_init(&mon->mc->parser, handle_qmp_command); json_message_parser_init(&mon->mc->parser, handle_qmp_command);
data = get_qmp_greeting(); data = get_qmp_greeting();
assert(data != NULL);
monitor_json_emitter(mon, data); monitor_json_emitter(mon, data);
qobject_decref(data); qobject_decref(data);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册