Nikolay Sivov : oleaut32/typelib: Get rid of redundant argument in typeinfo lookup helper.
Alexandre Julliard
julliard at winehq.org
Tue Dec 10 15:58:49 CST 2019
Module: wine
Branch: master
Commit: 5d05d4acd696ea4f2a503d35a269959a7d5f115d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5d05d4acd696ea4f2a503d35a269959a7d5f115d
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Dec 10 16:49:03 2019 +0300
oleaut32/typelib: Get rid of redundant argument in typeinfo lookup helper.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/oleaut32/typelib.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 668ad8d582..f490795cc7 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1724,15 +1724,16 @@ static inline TLBCustData *TLB_get_custdata_by_guid(struct list *custdata_list,
return NULL;
}
-static inline ITypeInfoImpl *TLB_get_typeinfo_by_name(ITypeInfoImpl **typeinfos,
- UINT n, const OLECHAR *name)
+static inline ITypeInfoImpl *TLB_get_typeinfo_by_name(ITypeLibImpl *typelib, const OLECHAR *name)
{
- while(n){
- if(!lstrcmpiW(TLB_get_bstr((*typeinfos)->Name), name))
- return *typeinfos;
- ++typeinfos;
- --n;
+ int i;
+
+ for (i = 0; i < typelib->TypeInfoCount; ++i)
+ {
+ if (!lstrcmpiW(TLB_get_bstr(typelib->typeinfos[i]->Name), name))
+ return typelib->typeinfos[i];
}
+
return NULL;
}
@@ -5507,7 +5508,7 @@ static HRESULT WINAPI ITypeLibComp_fnBindType(
if(!szName || !ppTInfo || !ppTComp)
return E_INVALIDARG;
- info = TLB_get_typeinfo_by_name(This->typeinfos, This->TypeInfoCount, szName);
+ info = TLB_get_typeinfo_by_name(This, szName);
if(!info){
*ppTInfo = NULL;
*ppTComp = NULL;
@@ -9007,7 +9008,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(ICreateTypeLib2 *iface,
if (!ctinfo || !name)
return E_INVALIDARG;
- info = TLB_get_typeinfo_by_name(This->typeinfos, This->TypeInfoCount, name);
+ info = TLB_get_typeinfo_by_name(This, name);
if (info)
return TYPE_E_NAMECONFLICT;
More information about the wine-cvs
mailing list