Small cleanup in list handling

Robert Shearman rob at codeweavers.com
Wed May 18 05:53:30 CDT 2005


Dimi Paun wrote:

>Index: dlls/ntdll/exception.c
>===================================================================
>RCS file: /var/cvs/wine/dlls/ntdll/exception.c,v
>retrieving revision 1.75
>diff -u -p -r1.75 exception.c
>--- dlls/ntdll/exception.c	13 May 2005 13:56:47 -0000	1.75
>+++ dlls/ntdll/exception.c	13 May 2005 19:01:31 -0000
>@@ -480,7 +480,8 @@ ULONG WINAPI RtlRemoveVectoredExceptionH
>     RtlEnterCriticalSection( &vectored_handlers_section );
>     LIST_FOR_EACH( ptr, &vectored_handlers )
>     {
>-        if (ptr == &((VECTORED_HANDLER *)handler)->entry)
>+        VECTORED_HANDLER *curr_handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
>+        if (curr_handler == handler)
>         {
>             list_remove( ptr );
>             ret = TRUE;
>  
>

This patch has already been committed, but for future reference code of 
this form:

LIST_FOR_EACH( cursor, list)
{
    TYPE list_entry = LIST_ENTRY( cursor, TYPE, entry );
    ...

Can be replaced by the following for IMHO, slightly more readable code:

LIST_FOR_EACH_ENTRY( list_entry, list, TYPE, entry)
{
    ...

Rob



More information about the wine-devel mailing list