Module Name:    src
Committed By:   isaki
Date:           Sun Aug 20 03:02:36 UTC 2017

Modified Files:
        src/sys/dev: audio.c

Log Message:
Remove goto in mix_write()


To generate a diff of this commit:
cvs rdiff -u -r1.400 -r1.401 src/sys/dev/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.400 src/sys/dev/audio.c:1.401
--- src/sys/dev/audio.c:1.400	Thu Aug 17 04:33:22 2017
+++ src/sys/dev/audio.c	Sun Aug 20 03:02:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.400 2017/08/17 04:33:22 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.401 2017/08/20 03:02:36 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.400 2017/08/17 04:33:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.401 2017/08/20 03:02:36 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5443,39 +5443,37 @@ mix_write(void *arg)
 	blksize = vc->sc_mpr.blksize;
 	error = 0;
 
-	if (audio_stream_get_used(vc->sc_pustream) > blksize)
-		goto done;
-
-	tocopy = vc->sc_pustream->inp;
-	orig = sc->sc_pr.s.outp;
-	used = blksize;
-	while (used > 0) {
-		cc = used;
-		cc1 = vc->sc_pustream->end - tocopy;
-		cc2 = sc->sc_pr.s.end - orig;
-		if (cc > cc1)
-			cc = cc1;
-		if (cc > cc2)
-			cc = cc2;
-		memcpy(tocopy, orig, cc);
-		orig += cc;
-		tocopy += cc;
-
-		if (tocopy >= vc->sc_pustream->end)
-			tocopy = vc->sc_pustream->start;
-		if (orig >= sc->sc_pr.s.end)
-			orig = sc->sc_pr.s.start;
+	if (audio_stream_get_used(vc->sc_pustream) <= blksize) {
+		tocopy = vc->sc_pustream->inp;
+		orig = sc->sc_pr.s.outp;
+		used = blksize;
+		while (used > 0) {
+			cc = used;
+			cc1 = vc->sc_pustream->end - tocopy;
+			cc2 = sc->sc_pr.s.end - orig;
+			if (cc > cc1)
+				cc = cc1;
+			if (cc > cc2)
+				cc = cc2;
+			memcpy(tocopy, orig, cc);
+			orig += cc;
+			tocopy += cc;
+
+			if (tocopy >= vc->sc_pustream->end)
+				tocopy = vc->sc_pustream->start;
+			if (orig >= sc->sc_pr.s.end)
+				orig = sc->sc_pr.s.start;
 
-		used -= cc;
- 	}
+			used -= cc;
+		}
 
-	vc->sc_pustream->inp = audio_stream_add_inp(vc->sc_pustream,
-	    vc->sc_pustream->inp, blksize);
+		vc->sc_pustream->inp = audio_stream_add_inp(vc->sc_pustream,
+		    vc->sc_pustream->inp, blksize);
 
-	sc->sc_pr.s.outp = audio_stream_add_outp(&sc->sc_pr.s,
-	    sc->sc_pr.s.outp, blksize);
+		sc->sc_pr.s.outp = audio_stream_add_outp(&sc->sc_pr.s,
+		    sc->sc_pr.s.outp, blksize);
+	}
 
-done:
 	if (vc->sc_npfilters > 0) {
 		null_fetcher.fetch_to = null_fetcher_fetch_to;
 		filter = vc->sc_pfilters[0];

Reply via email to