+
+    if (!qapi_event_functions.emit) {

Better to return an error here instead of silently failing.


    The purpose is allowing emit=NULL and skip event code in that case.

But the code will do nothing and the caller won't know that.

  Now the caller also won't know that useless code will be executed,
when qemu-img link with stub of monitor_event functions. :)

Actually, I wonder if the code should even abort() in such a case,
as emit=NULL would be a programming today.


  I am not sure why the code should always do something. The code may
actually take CPU resource to do nothing meanful, such as build up a
qdict and release it later, when emit is not a valid function. So I
did this as an improvement: check emit function ahead to escape useless
work.


Reply via email to