summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-13 13:01:08 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-13 22:36:12 +1100
commit700f4649511dbef417e639509d2f3374b5c8c6f3 (patch)
tree1df983dacd7e07e6c4cc06360531f47f05d4f0dc /source4/torture/smb2
parentf954f522a457a44e7b298e553907d59d670c9051 (diff)
downloadsamba-700f4649511dbef417e639509d2f3374b5c8c6f3.tar.gz
samba-700f4649511dbef417e639509d2f3374b5c8c6f3.tar.bz2
samba-700f4649511dbef417e639509d2f3374b5c8c6f3.zip
s4-torture: use TYPESAFE_QSORT() in smbtorture
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r--source4/torture/smb2/dir.c4
-rw-r--r--source4/torture/smb2/streams.c16
2 files changed, 7 insertions, 13 deletions
diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
index df2963b69a..b1a85392a7 100644
--- a/source4/torture/smb2/dir.c
+++ b/source4/torture/smb2/dir.c
@@ -34,6 +34,7 @@
#include "torture/util.h"
#include "system/filesys.h"
+#include "lib/util/tsort.h"
#define DNAME "smb2_dir"
#define NFILES 100
@@ -808,8 +809,7 @@ static bool test_many_files(struct torture_context *tctx,
compare_data_level = search_types[t].data_level;
level_sort = search_types[t].level;
- qsort(result.list, result.count, sizeof(result.list[0]),
- QSORT_CAST search_compare);
+ TYPESAFE_QSORT(result.list, result.count, search_compare);
for (i=0;i<result.count;i++) {
const char *s;
diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c
index 8065cbf2e1..f4e83c9ad3 100644
--- a/source4/torture/smb2/streams.c
+++ b/source4/torture/smb2/streams.c
@@ -28,6 +28,7 @@
#include "system/filesys.h"
#include "system/locale.h"
+#include "lib/util/tsort.h"
#define DNAME "teststreams"
@@ -79,19 +80,13 @@
}} while (0)
-static int qsort_string(const void *v1,
- const void *v2)
+static int qsort_string(char * const *s1, char * const *s2)
{
- char * const *s1 = v1;
- char * const *s2 = v2;
return strcmp(*s1, *s2);
}
-static int qsort_stream(const void *v1,
- const void *v2)
+static int qsort_stream(const struct stream_struct * s1, const struct stream_struct *s2)
{
- const struct stream_struct * s1 = v1;
- const struct stream_struct * s2 = v2;
return strcmp(s1->stream_name.s, s2->stream_name.s);
}
@@ -197,7 +192,7 @@ static bool check_stream_list(struct smb2_tree *tree,
goto fail;
}
- qsort(exp_sort, num_exp, sizeof(*exp_sort), qsort_string);
+ TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
finfo.stream_info.out.num_streams *
@@ -207,8 +202,7 @@ static bool check_stream_list(struct smb2_tree *tree,
goto fail;
}
- qsort(stream_sort, finfo.stream_info.out.num_streams,
- sizeof(*stream_sort), qsort_stream);
+ TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
for (i=0; i<num_exp; i++) {
if (strcmp(exp_sort[i], stream_sort[i].stream_name.s) != 0) {