From owner-svn-src-all@FreeBSD.ORG Fri Apr 13 22:34:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4572A106566B; Fri, 13 Apr 2012 22:34:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 315248FC14; Fri, 13 Apr 2012 22:34:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3DMY2Cx000541; Fri, 13 Apr 2012 22:34:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3DMY21g000539; Fri, 13 Apr 2012 22:34:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201204132234.q3DMY21g000539@svn.freebsd.org> From: Xin LI Date: Fri, 13 Apr 2012 22:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234244 - head/usr.sbin/lpr/lpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2012 22:34:02 -0000 Author: delphij Date: Fri Apr 13 22:34:01 2012 New Revision: 234244 URL: http://svn.freebsd.org/changeset/base/234244 Log: 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 Modified: head/usr.sbin/lpr/lpc/cmds.c Modified: head/usr.sbin/lpr/lpc/cmds.c ============================================================================== --- head/usr.sbin/lpr/lpc/cmds.c Fri Apr 13 22:31:49 2012 (r234243) +++ head/usr.sbin/lpr/lpc/cmds.c Fri Apr 13 22:34:01 2012 (r234244) @@ -79,7 +79,7 @@ static char *args2line(int argc, char ** 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