aboutsummaryrefslogtreecommitdiff
path: root/balloon.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-07-20 13:14:12 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-04 16:43:09 -0500
commit182b9203f8f17198b1f818c23d80a2c698f29fa5 (patch)
treefcaa50ca2f97d9e8e678d6036813850317e5780d /balloon.c
parentb80bc1ddb2e5838f8bc86f7cc8a45d16c8d8dcba (diff)
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>
Diffstat (limited to 'balloon.c')
-rw-r--r--balloon.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/balloon.c b/balloon.c
index 86f629e77a..d40be39b3b 100644
--- a/balloon.c
+++ b/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)
{
- if (balloon_event_fn) {
- trace_balloon_event(balloon_opaque, target);
- balloon_event_fn(balloon_opaque, target, cb, opaque);
- return 1;
- } else {
+ if (!balloon_event_fn) {
return 0;
}
+ trace_balloon_event(balloon_opaque, target);
+ balloon_event_fn(balloon_opaque, target, cb, opaque);
+ return 1;
}
static int qemu_balloon_status(MonitorCompletion cb, void *opaque)
{
- if (balloon_event_fn) {
- balloon_event_fn(balloon_opaque, 0, cb, opaque);
- return 1;
- } else {
+ if (!balloon_event_fn) {
return 0;
}
+ balloon_event_fn(balloon_opaque, 0, cb, opaque);
+ return 1;
}
static void print_balloon_stat(const char *key, QObject *obj, void *opaque)