alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
To: patch@alsa-project.org
Cc: Adrian Knoth <adi@drcomp.erfurt.thur.de>, alsa-devel@alsa-project.org
Subject: [PATCH - hdspmixer 3/4] hdspmixer: Beautification; Lower nesting depth
Date: Thu,  3 Feb 2011 22:43:36 +0100	[thread overview]
Message-ID: <1296769417-1320-4-git-send-email-adi@drcomp.erfurt.thur.de> (raw)
In-Reply-To: <1296769417-1320-1-git-send-email-adi@drcomp.erfurt.thur.de>

Exit the loop if card < 0. No need to nest the actual code in the else
branch.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>

diff --git a/hdspmixer/src/hdspmixer.cxx b/hdspmixer/src/hdspmixer.cxx
index 7e83c23..6d85062 100644
--- a/hdspmixer/src/hdspmixer.cxx
+++ b/hdspmixer/src/hdspmixer.cxx
@@ -49,45 +49,45 @@ int main(int argc, char **argv)
     while (snd_card_next(&card) >= 0) {
         if (card < 0) {
             break;
-        } else {
-            snd_card_get_longname(card, &name);
-            printf("Card %d : %s\n", card, name);
-            if (!strncmp(name, "RME Hammerfall DSP + Multiface", 30)) {
-                printf("Multiface found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(Multiface, card);
-                cards++;
-            } else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
-                printf("Digiface found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(Digiface, card);
-                cards++;
-            } else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
-                printf("HDSP 9652 found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(H9652, card);
-                cards++;
-            } else if (!strncmp(name, "RME Hammerfall HDSP 9632", 24)) {
-                printf("HDSP 9632 found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(H9632, card);
-                cards++;
-            } else if (!strncmp(name, "RME MADIface", 12)) {
-                printf("RME MADIface found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
-                cards++;
-            } else if (!strncmp(name, "RME MADI", 8)) {
-                printf("RME MADI found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
-                cards++;
-            } else if (!strncmp(name, "RME RayDAT", 10)) {
-                printf("RME RayDAT found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card);
-                cards++;
-            } else if (!strncmp(name, "RME AIO", 7)) {
-                printf("RME AIO found !\n");
-                hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card);
-                cards++;
-            } else if (!strncmp(name, "RME Hammerfall DSP", 18)) {
-                printf("Uninitialized HDSP card found.\nUse hdsploader to upload configuration data to the card.\n");
-            } 
         }
+
+        snd_card_get_longname(card, &name);
+        printf("Card %d : %s\n", card, name);
+        if (!strncmp(name, "RME Hammerfall DSP + Multiface", 30)) {
+            printf("Multiface found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(Multiface, card);
+            cards++;
+        } else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
+            printf("Digiface found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(Digiface, card);
+            cards++;
+        } else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
+            printf("HDSP 9652 found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(H9652, card);
+            cards++;
+        } else if (!strncmp(name, "RME Hammerfall HDSP 9632", 24)) {
+            printf("HDSP 9632 found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(H9632, card);
+            cards++;
+        } else if (!strncmp(name, "RME MADIface", 12)) {
+            printf("RME MADIface found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
+            cards++;
+        } else if (!strncmp(name, "RME MADI", 8)) {
+            printf("RME MADI found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
+            cards++;
+        } else if (!strncmp(name, "RME RayDAT", 10)) {
+            printf("RME RayDAT found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card);
+            cards++;
+        } else if (!strncmp(name, "RME AIO", 7)) {
+            printf("RME AIO found !\n");
+            hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card);
+            cards++;
+        } else if (!strncmp(name, "RME Hammerfall DSP", 18)) {
+            printf("Uninitialized HDSP card found.\nUse hdsploader to upload configuration data to the card.\n");
+        } 
     }
 
     free(name);
-- 
1.7.2.3

  parent reply	other threads:[~2011-02-03 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 21:43 [PATCH - hdspmixer 0/4] Beautification patches Adrian Knoth
2011-02-03 21:43 ` [PATCH - hdspmixer 1/4] hdspmixer: retab and reindent code Adrian Knoth
2011-02-03 21:43 ` [PATCH - hdspmixer 2/4] hdspmixer: Improve readability Adrian Knoth
2011-02-03 21:43 ` Adrian Knoth [this message]
2011-02-03 21:43 ` [PATCH - hdspmixer 4/4] hdspmixer: Break overlong line and don't plenken Adrian Knoth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296769417-1320-4-git-send-email-adi@drcomp.erfurt.thur.de \
    --to=adi@drcomp.erfurt.thur.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).