summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-14 10:02:54 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-14 18:44:21 +1100
commitbc5d203eeb49ad4c6ff85cff6b05577d81cf1816 (patch)
tree0907fbb0f3e1404d87460010f530c198d44455d7 /source3/rpc_server
parent93a33597292eee51b1f8714526cd145d4abe56c1 (diff)
downloadsamba-bc5d203eeb49ad4c6ff85cff6b05577d81cf1816.tar.gz
samba-bc5d203eeb49ad4c6ff85cff6b05577d81cf1816.tar.bz2
samba-bc5d203eeb49ad4c6ff85cff6b05577d81cf1816.zip
s3-rpc: convert wkssvc to use TYPESAFE_QSORT()
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_wkssvc_nt.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c
index d7f3f82298..a8cbfba368 100644
--- a/source3/rpc_server/srv_wkssvc_nt.c
+++ b/source3/rpc_server/srv_wkssvc_nt.c
@@ -45,11 +45,8 @@ struct usrinfo {
struct timeval login_time;
};
-static int usr_info_cmp(const void *p1, const void *p2)
+static int usr_info_cmp(const struct usrinfo *usr1, const struct usrinfo *usr2)
{
- const struct usrinfo *usr1 = (const struct usrinfo *)p1;
- const struct usrinfo *usr2 = (const struct usrinfo *)p2;
-
/* Called from qsort to compare two users in a usrinfo_t array for
* sorting by login time. Return >0 if usr1 login time was later than
* usr2 login time, <0 if it was earlier */
@@ -104,7 +101,7 @@ static char **get_logged_on_userlist(TALLOC_CTX *mem_ctx)
}
/* Sort the user list by time, oldest first */
- qsort(usr_infos, num_users, sizeof(struct usrinfo), usr_info_cmp);
+ TYPESAFE_QSORT(usr_infos, num_users, usr_info_cmp);
users = (char**)talloc_array(mem_ctx, char*, num_users);
if (users) {
@@ -127,14 +124,11 @@ static char **get_logged_on_userlist(TALLOC_CTX *mem_ctx)
#endif
-static int dom_user_cmp(const void *p1, const void *p2)
+static int dom_user_cmp(const struct dom_usr *usr1, const struct dom_usr *usr2)
{
/* Called from qsort to compare two domain users in a dom_usr_t array
* for sorting by login time. Return >0 if usr1 login time was later
* than usr2 login time, <0 if it was earlier */
- const struct dom_usr *usr1 = (const struct dom_usr *)p1;
- const struct dom_usr *usr2 = (const struct dom_usr *)p2;
-
return (usr1->login_time - usr2->login_time);
}
@@ -235,7 +229,7 @@ static struct dom_usr *get_domain_userlist(TALLOC_CTX *mem_ctx)
users = tmp;
/* Sort the user list by time, oldest first */
- qsort(users, num_users, sizeof(struct dom_usr), dom_user_cmp);
+ TYPESAFE_QSORT(users, num_users, dom_user_cmp);
errno = 0;
return users;