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

Michael Stefaniuc mstefani at redhat.com
Thu Jun 16 06:42:30 CDT 2011


Please ignore this one. I was too excited about this easy task for 
coccinelle that I missed Joerg's second patch.

bye
	michael

On 06/16/2011 01:39 PM, Michael Stefaniuc wrote:
> ---
> 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)
>                       {


-- 
Michael Stefaniuc                           Tel.: +49-711-96437-199
Consulting Communications Engineer          Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Otto-Hahn-Strasse 20, 85609 Dornach
Handelsregister: Amtsgericht Muenchen HRB 153243
Geschäftsführer: Brendan Lane, Charlie Peters, Michael Cunningham,
                  Charles Cachera



More information about the wine-devel mailing list