[PATCH 1/4] shell32/autocomplete: Sort the enumerated strings using a helper function
Gabriel Ivăncescu
gabrielopcode at gmail.com
Wed Nov 28 10:27:46 CST 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/shell32/autocomplete.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 236ba15..b9ea68f 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -103,11 +103,16 @@ static void set_text_and_selection(IAutoCompleteImpl *ac, HWND hwnd, WCHAR *text
CallWindowProcW(proc, hwnd, EM_SETSEL, start, end);
}
-static int enumerate_strings_cmpfn(const void *a, const void *b)
+static int sort_strs_cmpfn(const void *a, const void *b)
{
return strcmpiW(*(WCHAR* const*)a, *(WCHAR* const*)b);
}
+static void sort_strs(WCHAR **strs, UINT numstrs)
+{
+ qsort(strs, numstrs, sizeof(*strs), sort_strs_cmpfn);
+}
+
/*
Enumerate all of the strings and sort them in the internal list.
@@ -140,7 +145,7 @@ static void enumerate_strings(IAutoCompleteImpl *ac)
{
strs = tmp;
if (cur > 0)
- qsort(strs, cur, sizeof(*strs), enumerate_strings_cmpfn);
+ sort_strs(strs, cur);
ac->enum_strs = strs;
ac->enum_strs_num = cur;
--
2.19.1
More information about the wine-devel
mailing list