Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/apartment.c | 12 ++++-------- dlls/combase/marshal.c | 20 ++++++++------------ dlls/combase/stubmanager.c | 28 ++++++++-------------------- 3 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/dlls/combase/apartment.c b/dlls/combase/apartment.c index 125eaff1429..5fbec944eb0 100644 --- a/dlls/combase/apartment.c +++ b/dlls/combase/apartment.c @@ -629,13 +629,11 @@ struct apartment * apartment_get_current_or_mta(void) /* The given OXID must be local to this process */ struct apartment * apartment_findfromoxid(OXID oxid) { - struct apartment *result = NULL; - struct list *cursor; + struct apartment *result = NULL, *apt;
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) { result = apt; @@ -653,13 +651,11 @@ struct apartment * apartment_findfromoxid(OXID oxid) * is no longer required. */ struct apartment * apartment_findfromtid(DWORD tid) { - struct apartment *result = NULL; - struct list *cursor; + struct apartment *result = NULL, *apt;
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) { result = apt; diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c index bcc78132651..bdfb44bffac 100644 --- a/dlls/combase/marshal.c +++ b/dlls/combase/marshal.c @@ -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) { HRESULT hr = E_NOINTERFACE; /* assume not found */ - struct list * cursor; + struct ifproxy *ifproxy;
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)) { *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) { - struct list * cursor; + struct ifproxy *ifproxy;
TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid), wine_dbgstr_longlong(This->oid)); @@ -1836,9 +1835,8 @@ static void proxy_manager_disconnect(struct proxy_manager * This) * working */ 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); } } @@ -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. */ static BOOL find_proxy_manager(struct apartment * apt, OXID oxid, OID oid, struct proxy_manager ** proxy_found) { + struct proxy_manager *proxy; BOOL found = FALSE; - struct list * cursor;
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)) { /* 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) { - 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); }
diff --git a/dlls/combase/stubmanager.c b/dlls/combase/stubmanager.c index 16b8bb35d00..e9f20962e3b 100644 --- a/dlls/combase/stubmanager.c +++ b/dlls/combase/stubmanager.c @@ -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) { - struct list *cursor; - struct ifstub *result = NULL; + struct ifstub *result = NULL, *ifstub;
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)) { 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 */ struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnknown *obj, BOOL alloc) { - struct stub_manager *result = NULL; - struct list *cursor; + struct stub_manager *result = NULL, *m; IUnknown *object; HRESULT hres;
@@ -350,10 +346,8 @@ struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnkno }
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) { 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 */ struct stub_manager * get_stub_manager(struct apartment *apt, OID oid) { - struct stub_manager *result = NULL; - struct list *cursor; + struct stub_manager *result = NULL, *m;
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) { 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 */ static struct stub_manager *get_stub_manager_from_ipid(struct apartment *apt, const IPID *ipid, struct ifstub **ifstub) { - struct stub_manager *result = NULL; - struct list *cursor; + struct stub_manager *result = NULL, *m;
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))) { result = m;