mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 08:13:18 +00:00
shell32/autocomplete: Sort the enumerated strings using a helper function.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1582ae6b04
commit
d288d4dbd1
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue