diff options
author | Xin LI <delphij@FreeBSD.org> | 2012-04-13 22:34:01 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2012-04-13 22:34:01 +0000 |
commit | 2c81fb6a723ef0740f09118b32c0b752a07a6f37 (patch) | |
tree | f5a223e26839d40e24676334780547881aedb4b8 /usr.sbin | |
parent | ce2cb7926914d1032b40089d3fd15b7279db71ec (diff) | |
download | src-2c81fb6a723ef0740f09118b32c0b752a07a6f37.tar.gz src-2c81fb6a723ef0740f09118b32c0b752a07a6f37.zip |
The scandir(3) function expects fourth parameter, compar, be in type of:
int (*compar)(const struct dirent **, const struct dirent **)
The current code defines sortq() to accept two void *, then cast them
to const struct dirent **. Because the code does not really need this
cast, we can eliminate the casts by changing the function prototype
to match scandir(3) expectation.
MFC after: 1 month
Notes
Notes:
svn path=/head/; revision=234244
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/lpr/lpc/cmds.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index 6118f47a287f..71aaa1a00148 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -79,7 +79,7 @@ static char *args2line(int argc, char **argv); static int doarg(char *_job); static int doselect(const struct dirent *_d); static int kill_qtask(const char *lf); -static int sortq(const void *_a, const void *_b); +static int sortq(const struct dirent **a, const struct dirent **b); static int touch(struct jobqueue *_jq); static void unlinkf(char *_name); static void upstat(struct printer *_pp, const char *_msg, int _notify); @@ -486,14 +486,14 @@ doselect(const struct dirent *d) * filenames (they will have datafile names which start with `dfB*'). */ static int -sortq(const void *a, const void *b) +sortq(const struct dirent **a, const struct dirent **b) { const int a_lt_b = -1, a_gt_b = 1, cat_other = 10; const char *fname_a, *fname_b, *jnum_a, *jnum_b; int cat_a, cat_b, ch, res, seq_a, seq_b; - fname_a = (*(const struct dirent * const *)a)->d_name; - fname_b = (*(const struct dirent * const *)b)->d_name; + fname_a = (*a)->d_name; + fname_b = (*b)->d_name; /* * First separate filenames into categories. Categories are |