Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Remove goto in mix_write()
details: https://anonhg.NetBSD.org/src/rev/cc3a400dbee4
branches: trunk
changeset: 355879:cc3a400dbee4
user: isaki <isaki%NetBSD.org@localhost>
date: Sun Aug 20 03:02:36 2017 +0000
description:
Remove goto in mix_write()
diffstat:
sys/dev/audio.c | 68 +++++++++++++++++++++++++++-----------------------------
1 files changed, 33 insertions(+), 35 deletions(-)
diffs (89 lines):
diff -r 95fc8af35052 -r cc3a400dbee4 sys/dev/audio.c
--- a/sys/dev/audio.c Sun Aug 20 00:03:12 2017 +0000
+++ b/sys/dev/audio.c Sun Aug 20 03:02:36 2017 +0000
@@ -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 <nathanialsloss%yahoo.com.au@localhost>
@@ -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 @@
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;
-
- used -= cc;
- }
-
- 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);
-
-done:
+ 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;
+ }
+
+ 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);
+ }
+
if (vc->sc_npfilters > 0) {
null_fetcher.fetch_to = null_fetcher_fetch_to;
filter = vc->sc_pfilters[0];
Home |
Main Index |
Thread Index |
Old Index