[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 2/3] qapi script: add support of event
From: |
Wenchao Xia |
Subject: |
Re: [Qemu-devel] [PATCH RFC 2/3] qapi script: add support of event |
Date: |
Mon, 02 Dec 2013 14:48:01 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
+
+ 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.
- Re: [Qemu-devel] [PATCH RFC 2/3] qapi script: add support of event,
Wenchao Xia <=