mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
balloon: Simplify code flow
Replace: if (foo) { ... } else { return 0; } by if (!foo) { return 0; } ... Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
b80bc1ddb2
commit
182b9203f8
1 changed files with 7 additions and 9 deletions
14
balloon.c
14
balloon.c
|
@ -42,23 +42,21 @@ void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque)
|
||||||
|
|
||||||
static int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque)
|
static int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque)
|
||||||
{
|
{
|
||||||
if (balloon_event_fn) {
|
if (!balloon_event_fn) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
trace_balloon_event(balloon_opaque, target);
|
trace_balloon_event(balloon_opaque, target);
|
||||||
balloon_event_fn(balloon_opaque, target, cb, opaque);
|
balloon_event_fn(balloon_opaque, target, cb, opaque);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qemu_balloon_status(MonitorCompletion cb, void *opaque)
|
static int qemu_balloon_status(MonitorCompletion cb, void *opaque)
|
||||||
{
|
{
|
||||||
if (balloon_event_fn) {
|
if (!balloon_event_fn) {
|
||||||
balloon_event_fn(balloon_opaque, 0, cb, opaque);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
balloon_event_fn(balloon_opaque, 0, cb, opaque);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_balloon_stat(const char *key, QObject *obj, void *opaque)
|
static void print_balloon_stat(const char *key, QObject *obj, void *opaque)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue