=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: shell32/autocomplete: Sort the enumerated strings using a helper function.

Alexandre Julliard julliard at winehq.org
Thu Nov 29 15:33:00 CST 2018


Module: wine
Branch: master
Commit: d288d4dbd176279b35748814a3b46e5a8d64c71c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d288d4dbd176279b35748814a3b46e5a8d64c71c

Author: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
Date:   Wed Nov 28 18:27:46 2018 +0200

shell32/autocomplete: Sort the enumerated strings using a helper function.

Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list