summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-14 10:03:12 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-14 18:44:21 +1100
commit3f0898a9f50a35ae94fda9b89809edae0cd9bbb3 (patch)
tree672f3aaac9f114a548c92a223ca2d1e304ee1fbc /source3/smbd
parentbc5d203eeb49ad4c6ff85cff6b05577d81cf1816 (diff)
downloadsamba-3f0898a9f50a35ae94fda9b89809edae0cd9bbb3.tar.gz
samba-3f0898a9f50a35ae94fda9b89809edae0cd9bbb3.tar.bz2
samba-3f0898a9f50a35ae94fda9b89809edae0cd9bbb3.zip
s3-smbd: convert lanman and notify code to TYPESAFE_QSORT()
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c8
-rw-r--r--source3/smbd/notify_internal.c8
2 files changed, 4 insertions, 12 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 4df1cea8d1..4c947749ba 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1439,9 +1439,7 @@ static bool api_RNetServerEnum2(connection_struct *conn, uint16 vuid,
data_len = fixed_len = string_len = 0;
missed = 0;
- if (total > 0) {
- qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
- }
+ TYPESAFE_QSORT(servers, total, srv_comp);
{
char *lastname=NULL;
@@ -1616,9 +1614,7 @@ static bool api_RNetServerEnum3(connection_struct *conn, uint16 vuid,
data_len = fixed_len = string_len = 0;
missed = 0;
- if (total > 0) {
- qsort(servers,total,sizeof(servers[0]),QSORT_CAST srv_comp);
- }
+ TYPESAFE_QSORT(servers, total, srv_comp);
if (first_name[0] != '\0') {
struct srv_info_struct *first_server = NULL;
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index db165f71cc..0467e672c1 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -200,10 +200,8 @@ static NTSTATUS notify_load(struct notify_context *notify, struct db_record *rec
/*
compare notify entries for sorting
*/
-static int notify_compare(const void *p1, const void *p2)
+static int notify_compare(const struct notify_entry *e1, const struct notify_entry *e2)
{
- const struct notify_entry *e1 = (const struct notify_entry *)p1;
- const struct notify_entry *e2 = (const struct notify_entry *)p2;
return strcmp(e1->path, e2->path);
}
@@ -339,9 +337,7 @@ static NTSTATUS notify_add_array(struct notify_context *notify, struct db_record
d->max_mask |= e->filter;
d->max_mask_subdir |= e->subdir_filter;
- if (d->num_entries > 1) {
- qsort(d->entries, d->num_entries, sizeof(d->entries[0]), notify_compare);
- }
+ TYPESAFE_QSORT(d->entries, d->num_entries, notify_compare);
/* recalculate the maximum masks */
d->max_mask = 0;