combase: Use typed list iteration macros.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-09-03 11:11:04 +03:00 committed by Alexandre Julliard
parent 2d91f7def1
commit 3255b4b86c
3 changed files with 20 additions and 40 deletions

View file

@ -629,13 +629,11 @@ struct apartment * apartment_get_current_or_mta(void)
/* The given OXID must be local to this process */ /* The given OXID must be local to this process */
struct apartment * apartment_findfromoxid(OXID oxid) struct apartment * apartment_findfromoxid(OXID oxid)
{ {
struct apartment *result = NULL; struct apartment *result = NULL, *apt;
struct list *cursor;
EnterCriticalSection(&apt_cs); EnterCriticalSection(&apt_cs);
LIST_FOR_EACH( cursor, &apts ) LIST_FOR_EACH_ENTRY(apt, &apts, struct apartment, entry)
{ {
struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
if (apt->oxid == oxid) if (apt->oxid == oxid)
{ {
result = apt; result = apt;
@ -653,13 +651,11 @@ struct apartment * apartment_findfromoxid(OXID oxid)
* is no longer required. */ * is no longer required. */
struct apartment * apartment_findfromtid(DWORD tid) struct apartment * apartment_findfromtid(DWORD tid)
{ {
struct apartment *result = NULL; struct apartment *result = NULL, *apt;
struct list *cursor;
EnterCriticalSection(&apt_cs); EnterCriticalSection(&apt_cs);
LIST_FOR_EACH( cursor, &apts ) LIST_FOR_EACH_ENTRY(apt, &apts, struct apartment, entry)
{ {
struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
if (apt->tid == tid) if (apt->tid == tid)
{ {
result = apt; result = apt;

View file

@ -1803,12 +1803,11 @@ static HRESULT proxy_manager_create_ifproxy(
static HRESULT proxy_manager_find_ifproxy(struct proxy_manager * This, REFIID riid, struct ifproxy ** ifproxy_found) static HRESULT proxy_manager_find_ifproxy(struct proxy_manager * This, REFIID riid, struct ifproxy ** ifproxy_found)
{ {
HRESULT hr = E_NOINTERFACE; /* assume not found */ HRESULT hr = E_NOINTERFACE; /* assume not found */
struct list * cursor; struct ifproxy *ifproxy;
EnterCriticalSection(&This->cs); EnterCriticalSection(&This->cs);
LIST_FOR_EACH(cursor, &This->interfaces) LIST_FOR_EACH_ENTRY(ifproxy, &This->interfaces, struct ifproxy, entry)
{ {
struct ifproxy * ifproxy = LIST_ENTRY(cursor, struct ifproxy, entry);
if (IsEqualIID(riid, &ifproxy->iid)) if (IsEqualIID(riid, &ifproxy->iid))
{ {
*ifproxy_found = ifproxy; *ifproxy_found = ifproxy;
@ -1823,7 +1822,7 @@ static HRESULT proxy_manager_find_ifproxy(struct proxy_manager * This, REFIID ri
static void proxy_manager_disconnect(struct proxy_manager * This) static void proxy_manager_disconnect(struct proxy_manager * This)
{ {
struct list * cursor; struct ifproxy *ifproxy;
TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid), TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid),
wine_dbgstr_longlong(This->oid)); wine_dbgstr_longlong(This->oid));
@ -1836,9 +1835,8 @@ static void proxy_manager_disconnect(struct proxy_manager * This)
* working */ * working */
if (!(This->sorflags & SORFP_NOLIFETIMEMGMT)) if (!(This->sorflags & SORFP_NOLIFETIMEMGMT))
{ {
LIST_FOR_EACH(cursor, &This->interfaces) LIST_FOR_EACH_ENTRY(ifproxy, &This->interfaces, struct ifproxy, entry)
{ {
struct ifproxy * ifproxy = LIST_ENTRY(cursor, struct ifproxy, entry);
ifproxy_disconnect(ifproxy); ifproxy_disconnect(ifproxy);
} }
} }
@ -1963,13 +1961,12 @@ static void proxy_manager_destroy(struct proxy_manager * This)
* reference to the proxy_manager when the object is no longer used. */ * reference to the proxy_manager when the object is no longer used. */
static BOOL find_proxy_manager(struct apartment * apt, OXID oxid, OID oid, struct proxy_manager ** proxy_found) static BOOL find_proxy_manager(struct apartment * apt, OXID oxid, OID oid, struct proxy_manager ** proxy_found)
{ {
struct proxy_manager *proxy;
BOOL found = FALSE; BOOL found = FALSE;
struct list * cursor;
EnterCriticalSection(&apt->cs); EnterCriticalSection(&apt->cs);
LIST_FOR_EACH(cursor, &apt->proxies) LIST_FOR_EACH_ENTRY(proxy, &apt->proxies, struct proxy_manager, entry)
{ {
struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
if ((oxid == proxy->oxid) && (oid == proxy->oid)) if ((oxid == proxy->oxid) && (oid == proxy->oid))
{ {
/* be careful of a race with ClientIdentity_Release, which would /* be careful of a race with ClientIdentity_Release, which would
@ -1989,11 +1986,10 @@ static BOOL find_proxy_manager(struct apartment * apt, OXID oxid, OID oid, struc
HRESULT apartment_disconnectproxies(struct apartment *apt) HRESULT apartment_disconnectproxies(struct apartment *apt)
{ {
struct list * cursor; struct proxy_manager *proxy;
LIST_FOR_EACH(cursor, &apt->proxies) LIST_FOR_EACH_ENTRY(proxy, &apt->proxies, struct proxy_manager, entry)
{ {
struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
proxy_manager_disconnect(proxy); proxy_manager_disconnect(proxy);
} }

View file

@ -137,14 +137,11 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
static struct ifstub *stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid) static struct ifstub *stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid)
{ {
struct list *cursor; struct ifstub *result = NULL, *ifstub;
struct ifstub *result = NULL;
EnterCriticalSection(&m->lock); EnterCriticalSection(&m->lock);
LIST_FOR_EACH( cursor, &m->ifstubs ) LIST_FOR_EACH_ENTRY(ifstub, &m->ifstubs, struct ifstub, entry)
{ {
struct ifstub *ifstub = LIST_ENTRY( cursor, struct ifstub, entry );
if (IsEqualGUID(ipid, &ifstub->ipid)) if (IsEqualGUID(ipid, &ifstub->ipid))
{ {
result = ifstub; result = ifstub;
@ -337,8 +334,7 @@ ULONG stub_manager_int_release(struct stub_manager *m)
* it must also call release on the stub manager when it is no longer needed */ * it must also call release on the stub manager when it is no longer needed */
struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnknown *obj, BOOL alloc) struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnknown *obj, BOOL alloc)
{ {
struct stub_manager *result = NULL; struct stub_manager *result = NULL, *m;
struct list *cursor;
IUnknown *object; IUnknown *object;
HRESULT hres; HRESULT hres;
@ -350,10 +346,8 @@ struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnkno
} }
EnterCriticalSection(&apt->cs); EnterCriticalSection(&apt->cs);
LIST_FOR_EACH(cursor, &apt->stubmgrs) LIST_FOR_EACH_ENTRY(m, &apt->stubmgrs, struct stub_manager, entry)
{ {
struct stub_manager *m = LIST_ENTRY( cursor, struct stub_manager, entry );
if (m->object == object) if (m->object == object)
{ {
result = m; result = m;
@ -386,14 +380,11 @@ struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnkno
* it must also call release on the stub manager when it is no longer needed */ * it must also call release on the stub manager when it is no longer needed */
struct stub_manager * get_stub_manager(struct apartment *apt, OID oid) struct stub_manager * get_stub_manager(struct apartment *apt, OID oid)
{ {
struct stub_manager *result = NULL; struct stub_manager *result = NULL, *m;
struct list *cursor;
EnterCriticalSection(&apt->cs); EnterCriticalSection(&apt->cs);
LIST_FOR_EACH(cursor, &apt->stubmgrs) LIST_FOR_EACH_ENTRY(m, &apt->stubmgrs, struct stub_manager, entry)
{ {
struct stub_manager *m = LIST_ENTRY(cursor, struct stub_manager, entry);
if (m->oid == oid) if (m->oid == oid)
{ {
result = m; result = m;
@ -480,14 +471,11 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tablewea
* it must also call release on the stub manager when it is no longer needed */ * it must also call release on the stub manager when it is no longer needed */
static struct stub_manager *get_stub_manager_from_ipid(struct apartment *apt, const IPID *ipid, struct ifstub **ifstub) static struct stub_manager *get_stub_manager_from_ipid(struct apartment *apt, const IPID *ipid, struct ifstub **ifstub)
{ {
struct stub_manager *result = NULL; struct stub_manager *result = NULL, *m;
struct list *cursor;
EnterCriticalSection(&apt->cs); EnterCriticalSection(&apt->cs);
LIST_FOR_EACH(cursor, &apt->stubmgrs) LIST_FOR_EACH_ENTRY(m, &apt->stubmgrs, struct stub_manager, entry)
{ {
struct stub_manager *m = LIST_ENTRY(cursor, struct stub_manager, entry);
if ((*ifstub = stub_manager_ipid_to_ifstub(m, ipid))) if ((*ifstub = stub_manager_ipid_to_ifstub(m, ipid)))
{ {
result = m; result = m;