[3/3] msi: Avoid lstrcmpW in string lookup.
Hans Leidekker
hans at codeweavers.com
Tue Dec 1 04:42:15 CST 2009
---
dlls/msi/string.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 5802912..a7e83bf 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -376,6 +376,14 @@ static UINT msi_id2stringA( const string_table *st, UINT id, LPSTR buffer, UINT
return ERROR_SUCCESS;
}
+static inline int compare_strings( const WCHAR *str1, UINT len1, const WCHAR *str2, UINT len2 )
+{
+ if (str1 == str2) return 0;
+ if (str1 == NULL || str2 == NULL) return 1;
+ if (len1 != len2) return 1;
+ return memcmp( str1, str2, len1 * sizeof(WCHAR) );
+}
+
/*
* msi_string2idW
*
@@ -390,7 +398,7 @@ UINT msi_string2idW( const string_table *st, LPCWSTR str, UINT *id )
for (n = st->hash[hash]; n != -1; n = st->strings[n].hash_next )
{
- if ((str == se[n].str) || (len == se[n].len && !lstrcmpW(str, se[n].str)))
+ if (!compare_strings( str, len, se[n].str, se[n].len ))
{
*id = n;
return ERROR_SUCCESS;
--
1.6.3.3
More information about the wine-patches
mailing list