strmbase: Use !list_empty() instead of list_count() > 0.
Joerg-Cyril.Hoehle at t-systems.com
Joerg-Cyril.Hoehle at t-systems.com
Thu Jun 16 02:59:05 CDT 2011
Hi,
list_count is unsafe to call while the list can be modified outside the protection of the critical section.
As there are other places with SetEvent within the CS, I simply moved LeaveCS down instead of using
if ... event= ...;
LeaveCS;
if(event) SetEvent(event);
A test for list_empty prior to LIST_FOR_EACH is superfluous because
a) it repeats the exact same test,
b) the setup cost for cursor1+2 is negligible,
c) the side effect of setting cursor1+2 doesn't matter in this case.
The code looks more symmetric now.
In Common Lisp, LENGTH > N could be replaced by the rarely used NTHCDR. However these days,
it looks like young Lispers prefer to write code with CLOS than with lists. Go figure.
Regards,
Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-strmbase-Use-list_empty-instead-of-list_count.patch
Type: application/octet-stream
Size: 4243 bytes
Desc: 0002-strmbase-Use-list_empty-instead-of-list_count.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20110616/1caf83d6/attachment.obj>
More information about the wine-patches
mailing list