Date: Wed, 16 May 2012 20:02:30 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r235514 - stable/8/usr.sbin/lpr/lpc Message-ID: <201205162002.q4GK2UpE059401@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed May 16 20:02:29 2012 New Revision: 235514 URL: http://svn.freebsd.org/changeset/base/235514 Log: MFC r234244: 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. Modified: stable/8/usr.sbin/lpr/lpc/cmds.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) Modified: stable/8/usr.sbin/lpr/lpc/cmds.c ============================================================================== --- stable/8/usr.sbin/lpr/lpc/cmds.c Wed May 16 20:00:33 2012 (r235513) +++ stable/8/usr.sbin/lpr/lpc/cmds.c Wed May 16 20:02:29 2012 (r235514) @@ -83,7 +83,7 @@ static char *args2line(int argc, char ** static int doarg(char *_job); static int doselect(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); @@ -490,14 +490,14 @@ doselect(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 cagatories. Catagories are
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205162002.q4GK2UpE059401>