[libvirt PATCH 1/4] vbox: use g_new0 in vboxDumpAudio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Elimination of the positive conditions reduces
the indentation by two levels.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 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);
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux