[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/5] Add non-null annotations to qemuMonitorOpen



From: "Daniel P. Berrange" <berrange redhat com>

Add some non-null annotations to qemuMonitorOpen and also
check that the error callback is set, since it is mandatory
---
 src/qemu/qemu_monitor.c | 7 ++++++-
 src/qemu/qemu_monitor.h | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6ce1839..290f150 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -683,11 +683,16 @@ qemuMonitorOpen(virDomainObjPtr vm,
 {
     qemuMonitorPtr mon;
 
-    if (!cb || !cb->eofNotify) {
+    if (!cb->eofNotify) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("EOF notify callback must be supplied"));
         return NULL;
     }
+    if (!cb->errorNotify) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Error notify callback must be supplied"));
+        return NULL;
+    }
 
     if (qemuMonitorInitialize() < 0)
         return NULL;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index ad8d2f1..2033473 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -145,7 +145,8 @@ char *qemuMonitorUnescapeArg(const char *in);
 qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
                                virDomainChrSourceDefPtr config,
                                int json,
-                               qemuMonitorCallbacksPtr cb);
+                               qemuMonitorCallbacksPtr cb)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
 
 void qemuMonitorClose(qemuMonitorPtr mon);
 
-- 
1.7.11.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]