All of lore.kernel.org
 help / color / mirror / Atom feed
From: <twischer@de.adit-jv.com>
To: patch@alsa-project.org
Cc: Timo Wischer <twischer@de.adit-jv.com>, alsa-devel@alsa-project.org
Subject: [PATCH - JACK plugin 1/2] jack: Refactoring: Lower indentation
Date: Thu, 24 Jan 2019 15:42:54 +0100	[thread overview]
Message-ID: <1548340975-32610-2-git-send-email-twischer@de.adit-jv.com> (raw)
In-Reply-To: <1548340975-32610-1-git-send-email-twischer@de.adit-jv.com>

From: Timo Wischer <twischer@de.adit-jv.com>

to full fill 80 character limit of next commit.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index b2bc213..724cbc2 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -105,23 +105,25 @@ static int pcm_poll_unblock_check(snd_pcm_ioplug_t *io)
 
 static void snd_pcm_jack_free(snd_pcm_jack_t *jack)
 {
-	if (jack) {
+	if (jack == NULL)
+		return;
+
+	if (jack->client)
+		jack_client_close(jack->client);
+	if (jack->port_names) {
 		unsigned int i;
-		if (jack->client)
-			jack_client_close(jack->client);
-		if (jack->port_names) {
-			for (i = 0; i < jack->num_ports; i++)
-				free(jack->port_names[i]);
-			free(jack->port_names);
-		}
-		if (jack->fd >= 0)
-			close(jack->fd);
-		if (jack->io.poll_fd >= 0)
-			close(jack->io.poll_fd);
-		free(jack->areas);
-		free(jack->ports);
-		free(jack);
+
+		for (i = 0; i < jack->num_ports; i++)
+			free(jack->port_names[i]);
+		free(jack->port_names);
 	}
+	if (jack->fd >= 0)
+		close(jack->fd);
+	if (jack->io.poll_fd >= 0)
+		close(jack->io.poll_fd);
+	free(jack->areas);
+	free(jack->ports);
+	free(jack);
 }
 
 static int snd_pcm_jack_close(snd_pcm_ioplug_t *io)
@@ -418,31 +420,34 @@ static int parse_ports(snd_pcm_jack_t *jack, snd_config_t *conf)
 	unsigned int cnt = 0;
 	unsigned int channel;
 
-	if (conf) {
-		snd_config_for_each(i, next, conf) {
-			snd_config_t *n = snd_config_iterator_entry(i);
-			const char *id;
-			if (snd_config_get_id(n, &id) < 0)
-				continue;
-			cnt++;
-		}
-		jack->port_names = ports = calloc(cnt, sizeof(char*));
-		if (ports == NULL)
-			return -ENOMEM;
-		jack->num_ports = cnt;
-		snd_config_for_each(i, next, conf) {
-			snd_config_t *n = snd_config_iterator_entry(i);
-			const char *id;
-			const char *port;
-
-			if (snd_config_get_id(n, &id) < 0)
-				continue;
-			channel = atoi(id);
-			if (snd_config_get_string(n, &port) < 0)
-				continue;
-			ports[channel] = port ? strdup(port) : NULL;
-		}
+	if (conf == NULL)
+		return 0;
+
+	snd_config_for_each(i, next, conf) {
+		snd_config_t *n = snd_config_iterator_entry(i);
+		const char *id;
+
+		if (snd_config_get_id(n, &id) < 0)
+			continue;
+		cnt++;
 	}
+	jack->port_names = ports = calloc(cnt, sizeof(char*));
+	if (ports == NULL)
+		return -ENOMEM;
+	jack->num_ports = cnt;
+	snd_config_for_each(i, next, conf) {
+		snd_config_t *n = snd_config_iterator_entry(i);
+		const char *id;
+		const char *port;
+
+		if (snd_config_get_id(n, &id) < 0)
+			continue;
+		channel = atoi(id);
+		if (snd_config_get_string(n, &port) < 0)
+			continue;
+		ports[channel] = port ? strdup(port) : NULL;
+	}
+
 	return 0;
 }
 
-- 
2.7.4

  reply	other threads:[~2019-01-24 14:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 14:42 [PATCH - JACK plugin 0/2] jack: Support to connect multiple ports twischer
2019-01-24 14:42 ` twischer [this message]
2019-01-24 14:42 ` [PATCH - JACK plugin 2/2] jack: Support to connect multiple JACK ports with same ALSA channel twischer
2019-01-29 13:45   ` Takashi Iwai

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=1548340975-32610-2-git-send-email-twischer@de.adit-jv.com \
    --to=twischer@de.adit-jv.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.