[libvirt] [PATCHv2] conf: remove NULL check from virDomainQemuMonitorEventNew

Ján Tomko posted 1 patch 4 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/13c957edf163f0604569f0dfae4f58cadba017ed.1573578242.git.jtomko@redhat.com
src/conf/domain_event.c | 12 ------------
src/conf/domain_event.h |  2 +-
2 files changed, 1 insertion(+), 13 deletions(-)
[libvirt] [PATCHv2] conf: remove NULL check from virDomainQemuMonitorEventNew
Posted by Ján Tomko 4 years, 5 months ago
The qemu_domain_monitor_event_msg struct in qemu_protocol.x
defines event as a nonnull_string and qemuMonitorJSONIOProcessEvent
also errors out on a non-NULL event.

Drop the check completely.

This essentially reverts commit d343e8203d248635f5e7a0d86dd077f74d49e3af

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_event.c | 12 ------------
 src/conf/domain_event.h |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 900d8f745e..33fbf10406 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1934,24 +1934,12 @@ virDomainQemuMonitorEventNew(int id,
                                  0, id, name, uuid, uuidstr)))
         return NULL;
 
-    /* event is mandatory, details are optional */
-    if (!event) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unexpected event=NULL name=%s uuid=%s details=%s"),
-                       name, uuidstr, NULLSTR(details));
-        goto error;
-    }
-
     ev->event = g_strdup(event);
     ev->seconds = seconds;
     ev->micros = micros;
     ev->details = g_strdup(details);
 
     return (virObjectEventPtr)ev;
-
- error:
-    virObjectUnref(ev);
-    return NULL;
 }
 
 
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 0a4bce3d04..d1cfb81d62 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -321,4 +321,4 @@ virDomainQemuMonitorEventNew(int id,
                              long long seconds,
                              unsigned int micros,
                              const char *details)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2] conf: remove NULL check from virDomainQemuMonitorEventNew
Posted by Michal Privoznik 4 years, 5 months ago
On 11/12/19 6:04 PM, Ján Tomko wrote:
> The qemu_domain_monitor_event_msg struct in qemu_protocol.x
> defines event as a nonnull_string and qemuMonitorJSONIOProcessEvent
> also errors out on a non-NULL event.
> 
> Drop the check completely.
> 
> This essentially reverts commit d343e8203d248635f5e7a0d86dd077f74d49e3af
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>   src/conf/domain_event.c | 12 ------------
>   src/conf/domain_event.h |  2 +-
>   2 files changed, 1 insertion(+), 13 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list