aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-08-27 23:02:20 -0700
committerEric Wong <normalperson@yhbt.net>2008-08-27 23:03:09 -0700
commita2c48a74265592922a1d1d1db0236dd782f6f7ec (patch)
tree225511da75129850cf75feaa5a09979f55b85f2f
parentc3acecd70808dc38807f4e9ae075d14d82cdb4a7 (diff)
downloadmpd-a2c48a74265592922a1d1d1db0236dd782f6f7ec.tar.gz
mpd-a2c48a74265592922a1d1d1db0236dd782f6f7ec.tar.xz
mpd-a2c48a74265592922a1d1d1db0236dd782f6f7ec.zip
metadata_pipe: inline clear_pipe_unlocked() function
I considered calling it from metadata_pipe_recv() in the past, but it's not necessary, so just inline it again to simplify things.
-rw-r--r--src/metadata_pipe.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/metadata_pipe.c b/src/metadata_pipe.c
index a92fdd61b..2dc2b608f 100644
--- a/src/metadata_pipe.c
+++ b/src/metadata_pipe.c
@@ -79,17 +79,6 @@ void metadata_pipe_send(MpdTag *tag, float metadata_time)
assert(written == sizeof(struct tag_container));
}
-static void pipe_clear_unlocked(void)
-{
- struct tag_container tc;
- size_t r;
-
- while ((r = ringbuf_read(mp, &tc, sizeof(struct tag_container)))) {
- assert(r == sizeof(struct tag_container));
- freeMpdTag(tc.tag);
- }
-}
-
MpdTag * metadata_pipe_recv(void)
{
struct tag_container tc;
@@ -150,7 +139,15 @@ MpdTag *metadata_pipe_current(void)
void metadata_pipe_clear(void)
{
+ struct tag_container tc;
+ size_t r;
+
pthread_mutex_lock(&read_lock);
- pipe_clear_unlocked();
+
+ while ((r = ringbuf_read(mp, &tc, sizeof(struct tag_container)))) {
+ assert(r == sizeof(struct tag_container));
+ freeMpdTag(tc.tag);
+ }
+
pthread_mutex_unlock(&read_lock);
}