From 4a1f4e898b0b0c4666a9c54c892884564bc27544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 2 Oct 2020 19:55:02 +0200 Subject: [PATCH] vbox: vboxDumpAudio: invert conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Elimination of the positive conditions reduces the indentation by two levels. Signed-off-by: Ján Tomko Reviewed-by: Erik Skultety --- src/vbox/vbox_common.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 9f6ef2f2ac..45fd670a11 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3798,20 +3798,16 @@ vboxDumpAudio(virDomainDefPtr def, vboxDriverPtr data G_GNUC_UNUSED, PRUint32 audioController = AudioControllerType_AC97; def->nsounds = 1; - if (VIR_ALLOC_N(def->sounds, def->nsounds) >= 0) { - if (VIR_ALLOC(def->sounds[0]) >= 0) { - gVBoxAPI.UIAudioAdapter.GetAudioController(audioAdapter, &audioController); - if (audioController == AudioControllerType_SB16) { - def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_SB16; - } else if (audioController == AudioControllerType_AC97) { - def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_AC97; - } - } else { - VIR_FREE(def->sounds); - def->nsounds = 0; - } - } else { - def->nsounds = 0; + if (VIR_ALLOC_N(def->sounds, def->nsounds) < 0) + return; + if (VIR_ALLOC(def->sounds[0]) < 0) + return; + + gVBoxAPI.UIAudioAdapter.GetAudioController(audioAdapter, &audioController); + if (audioController == AudioControllerType_SB16) { + def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_SB16; + } else if (audioController == AudioControllerType_AC97) { + def->sounds[0]->model = VIR_DOMAIN_SOUND_MODEL_AC97; } } VBOX_RELEASE(audioAdapter);