Author: gahr (ports committer) Date: Tue Jun 3 20:59:26 2014 New Revision: 267027 URL: http://svnweb.freebsd.org/changeset/base/267027
Log: - Avoid calling a wrapper function around strcmp - Use sizeof(*array) instead of sizeof(element) everywhere CR: D161 Approved by: cognet, bapt Modified: head/usr.bin/users/users.c Modified: head/usr.bin/users/users.c ============================================================================== --- head/usr.bin/users/users.c Tue Jun 3 20:58:11 2014 (r267026) +++ head/usr.bin/users/users.c Tue Jun 3 20:59:26 2014 (r267027) @@ -50,9 +50,9 @@ static const char rcsid[] = #include <unistd.h> #include <utmpx.h> -typedef char namebuf[sizeof(((struct utmpx *)0)->ut_user) + 1]; +typedef char namebuf[sizeof(((struct utmpx *)0)->ut_user) + 1]; +typedef int (*scmp)(const void *, const void *); -int scmp(const void *, const void *); static void usage(void); int @@ -91,7 +91,7 @@ main(int argc, char **argv) } endutxent(); if (ncnt > 0) { - qsort(names, ncnt, sizeof(namebuf), scmp); + qsort(names, ncnt, sizeof(*names), (scmp)strcmp); printf("%s", names[0]); for (cnt = 1; cnt < ncnt; ++cnt) if (strcmp(names[cnt], names[cnt - 1]) != 0) @@ -107,10 +107,3 @@ usage(void) fprintf(stderr, "usage: users\n"); exit(1); } - -int -scmp(const void *p, const void *q) -{ - - return (strcmp(p, q)); -} _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"