[vlc-commits] fifo: cleanup

Rémi Denis-Courmont git at videolan.org
Mon Apr 13 13:05:17 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 11 21:17:33 2020 +0300| [98313fa75c3edd62f6f9be223026171d9b73a3b3] | committer: Rémi Denis-Courmont

fifo: cleanup

Reuse own block_fifo_t functions.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98313fa75c3edd62f6f9be223026171d9b73a3b3
---

 src/misc/fifo.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/misc/fifo.c b/src/misc/fifo.c
index f6878d8eb8..564c83f64f 100644
--- a/src/misc/fifo.c
+++ b/src/misc/fifo.c
@@ -155,7 +155,7 @@ block_fifo_t *block_FifoNew( void )
 
 void block_FifoRelease( block_fifo_t *p_fifo )
 {
-    block_ChainRelease( p_fifo->p_first );
+    block_FifoEmpty(p_fifo);
     free( p_fifo );
 }
 
@@ -199,10 +199,10 @@ block_t *block_FifoShow( block_fifo_t *p_fifo )
 {
     block_t *b;
 
-    vlc_mutex_lock( &p_fifo->lock );
+    vlc_fifo_Lock(p_fifo);
     assert(p_fifo->p_first != NULL);
     b = p_fifo->p_first;
-    vlc_mutex_unlock( &p_fifo->lock );
+    vlc_fifo_Unlock(p_fifo);
 
     return b;
 }
@@ -212,9 +212,9 @@ size_t block_FifoSize (block_fifo_t *fifo)
 {
     size_t size;
 
-    vlc_mutex_lock (&fifo->lock);
-    size = fifo->i_size;
-    vlc_mutex_unlock (&fifo->lock);
+    vlc_fifo_Lock(fifo);
+    size = vlc_fifo_GetBytes(fifo);
+    vlc_fifo_Unlock(fifo);
     return size;
 }
 
@@ -223,8 +223,8 @@ size_t block_FifoCount (block_fifo_t *fifo)
 {
     size_t depth;
 
-    vlc_mutex_lock (&fifo->lock);
-    depth = fifo->i_depth;
-    vlc_mutex_unlock (&fifo->lock);
+    vlc_fifo_Lock(fifo);
+    depth = vlc_fifo_GetCount(fifo);
+    vlc_fifo_Unlock(fifo);
     return depth;
 }



More information about the vlc-commits mailing list