aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2025-11-11 12:05:24 +0000
committerChristos Margiolis <christos@FreeBSD.org>2025-11-11 12:05:24 +0000
commitc0e96595a4da90d890be88881a5dc3381da59dd7 (patch)
treef2af41f36bfcd6abe74e0251ac5b330364ae0ab9
parent06eb65e11d7a66caec358966dcf892c9f4c2e411 (diff)
sound: Simplify sndbuf_clear() loop
Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53526
-rw-r--r--sys/dev/sound/pcm/buffer.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c
index e3d2f27f9f81..0cfa04fc3167 100644
--- a/sys/dev/sound/pcm/buffer.c
+++ b/sys/dev/sound/pcm/buffer.c
@@ -276,16 +276,10 @@ sndbuf_clear(struct snd_dbuf *b, unsigned int length)
length = b->bufsize;
data = sndbuf_zerodata(b->fmt);
-
i = sndbuf_getfreeptr(b);
p = sndbuf_getbuf(b);
- while (length > 0) {
- p[i] = data;
- length--;
- i++;
- if (i >= b->bufsize)
- i = 0;
- }
+ for (; length > 0; length--, i++)
+ p[i % b->bufsize] = data;
}
/**