[PATCH 1/4] oleaut32/typelib: Get rid of redundant argument in typeinfo lookup helper. (original) (raw)
Nikolay Sivov nsivov at codeweavers.com
Tue Dec 10 07:49:03 CST 2019
- Previous message (by thread): [PATCH] vbscript: Remove unused field.
- Next message (by thread): [PATCH 2/4] oleaut32/typelib: Simplify variable and function description lookup helpers.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
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;
2.24.0
- Previous message (by thread): [PATCH] vbscript: Remove unused field.
- Next message (by thread): [PATCH 2/4] oleaut32/typelib: Simplify variable and function description lookup helpers.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]