
On Thu, Apr 16, 2015 at 14:38:25 +0200, Jiri Denemark wrote:
On Wed, Apr 15, 2015 at 16:27:35 +0200, Peter Krempa wrote:
Among all the monitor APIs some where checking if mon is NULL and some were not. Since it's possible to have mon equal to NULL in case a second call is attempted once entered the monitor. This requires that every single API checks for the monitor.
This patch adds a macro that helps checking the state of the monitor and either refactors existing checking code to use the macro or adds it in case it was missing. ---
Notes: Version 3: - fixed the check in qemuMonitorGetAllBlockStatsInfo by moving it before the allocation - added macros for all the return value combinations - removed 'mon' from existing VIR_DEBUG macros
src/qemu/qemu_monitor.c | 1151 ++++++++++++----------------------------------- src/qemu/qemu_monitor.h | 18 +- 2 files changed, 292 insertions(+), 877 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1f95547..6d7562d 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c ... @@ -4418,16 +3839,12 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon, virHashTablePtr *info) { - VIR_DEBUG("mon=%p info=%p", mon, info); + VIR_DEBUG("info=%p", info); int ret;
*info = NULL;
- if (!mon) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); - return -1; - } + QEMU_CHECK_MONITOR_JSON(mon);
s/QEMU_CHECK_MONITOR_JSON/QEMU_CHECK_MONITOR/ because of:
oh, right. I screwed up the last one :)
if (!mon->json) return -2;
The rest looks correct.
ACK once you fix this last issue.
Pushed; Thanks. Peter