strmbase: Don't use list_count() to check that a list is not empty.

Michael Stefaniuc mstefani at redhat.de
Thu Jun 16 06:39:30 CDT 2011


---
Thanks to Joerg for the inspiration to this sort coccinelle script:

@@
expression E;
@@
(
- list_count(E) == 0
+ list_empty(E)
|
- list_count(E) > 0
+ !list_empty(E)
)




 dlls/strmbase/outputqueue.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/strmbase/outputqueue.c b/dlls/strmbase/outputqueue.c
index 4f4ecf8..c8c268f 100644
--- a/dlls/strmbase/outputqueue.c
+++ b/dlls/strmbase/outputqueue.c
@@ -190,7 +190,7 @@ VOID WINAPI OutputQueue_SendAnyway(OutputQueue *pOutputQueue)
     if (pOutputQueue->hThread)
     {
         EnterCriticalSection(&pOutputQueue->csQueue);
-        if (list_count(pOutputQueue->SampleList) > 0)
+        if (!list_empty(pOutputQueue->SampleList))
         {
             pOutputQueue->bSendAnyway = TRUE;
             SetEvent(pOutputQueue->hProcessQueue);
@@ -235,14 +235,14 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
     do
     {
         EnterCriticalSection(&pOutputQueue->csQueue);
-        if (list_count(pOutputQueue->SampleList) > 0 &&
+        if (!list_empty(pOutputQueue->SampleList) &&
             (!pOutputQueue->bBatchExact ||
             list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
             pOutputQueue->bSendAnyway
             )
            )
         {
-            while (list_count(pOutputQueue->SampleList) > 0)
+            while (!list_empty(pOutputQueue->SampleList))
             {
                 IMediaSample **ppSamples;
                 LONG nSamples;
@@ -278,7 +278,7 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
                 HeapFree(GetProcessHeap(),0,ppSamples);
 
                 /* Process Non-Samples */
-                if (list_count(pOutputQueue->SampleList) > 0)
+                if (!list_empty(pOutputQueue->SampleList))
                 {
                     LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
                     {
-- 
1.7.4.4



More information about the wine-patches mailing list