s3-vfs: use TYPESAFE_QSORT() in s3 VFS modules
authorAndrew Tridgell <tridge@samba.org>
Sat, 13 Feb 2010 23:01:17 +0000 (10:01 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sun, 14 Feb 2010 07:44:20 +0000 (18:44 +1100)
source3/modules/vfs_dirsort.c
source3/modules/vfs_shadow_copy2.c

index c2053e14e66bda6c477a1601f2686ef7958c447c..d96aca0cb1129e78ead954b1bf02fa8bc45d3056 100644 (file)
@@ -20,9 +20,8 @@
 
 #include "includes.h"
 
-static int compare_dirent (const void *a, const void *b) {
-       const SMB_STRUCT_DIRENT *da = (const SMB_STRUCT_DIRENT *) a;
-       const SMB_STRUCT_DIRENT *db = (const SMB_STRUCT_DIRENT *) b;
+static int compare_dirent (const SMB_STRUCT_DIRENT *da, const SMB_STRUCT_DIRENT *db)
+{
        return StrCaseCmp(da->d_name, db->d_name);
 }
 
@@ -81,8 +80,7 @@ static void open_and_sort_dir (vfs_handle_struct *handle)
 
        /* Sort the directory entries by name */
        data->pos = current_pos;
-       qsort(data->directory_list, data->number_of_entries,
-             sizeof(SMB_STRUCT_DIRENT), compare_dirent);
+       TYPESAFE_QSORT(data->directory_list, data->number_of_entries, compare_dirent);
 }
 
 static SMB_STRUCT_DIR *dirsort_opendir(vfs_handle_struct *handle,
index b26bf272fea7b4e0b3af8ad13006c2c3d8708635..a4265474bf6038b860e3bfd8d2e243bff0a7f378 100644 (file)
@@ -838,9 +838,9 @@ static void shadow_copy2_sort_data(vfs_handle_struct *handle,
        if (shadow_copy2_data && shadow_copy2_data->num_volumes > 0 &&
            shadow_copy2_data->labels)
        {
-               qsort(shadow_copy2_data->labels,
-                     shadow_copy2_data->num_volumes,
-                     sizeof(SHADOW_COPY_LABEL), cmpfunc);
+               TYPESAFE_QSORT(shadow_copy2_data->labels,
+                              shadow_copy2_data->num_volumes,
+                              cmpfunc);
        }
 
        return;