Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 May 2017 04:44:14 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318514 - head/lib/libc/stdlib
Message-ID:  <201705190444.v4J4iEJ1018396@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri May 19 04:44:14 2017
New Revision: 318514
URL: https://svnweb.freebsd.org/changeset/base/318514

Log:
  Use size_t.
  
  Inspired by:	OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

Modified:
  head/lib/libc/stdlib/qsort.c

Modified: head/lib/libc/stdlib/qsort.c
==============================================================================
--- head/lib/libc/stdlib/qsort.c	Fri May 19 02:12:10 2017	(r318513)
+++ head/lib/libc/stdlib/qsort.c	Fri May 19 04:44:14 2017	(r318514)
@@ -41,7 +41,7 @@ typedef int		 cmp_t(void *, const void *
 typedef int		 cmp_t(const void *, const void *);
 #endif
 static inline char	*med3(char *, char *, char *, cmp_t *, void *);
-static inline void	 swapfunc(char *, char *, int, int, int);
+static inline void	 swapfunc(char *, char *, size_t, int, int);
 
 #define	MIN(a, b)	((a) < (b) ? a : b)
 
@@ -49,7 +49,7 @@ static inline void	 swapfunc(char *, cha
  * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
  */
 #define	swapcode(TYPE, parmi, parmj, n) {		\
-	long i = (n) / sizeof (TYPE);			\
+	size_t i = (n) / sizeof (TYPE);			\
 	TYPE *pi = (TYPE *) (parmi);		\
 	TYPE *pj = (TYPE *) (parmj);		\
 	do { 						\
@@ -64,7 +64,7 @@ static inline void	 swapfunc(char *, cha
 	es % sizeof(TYPE) ? 2 : es == sizeof(TYPE) ? 0 : 1;
 
 static inline void
-swapfunc( char *a, char *b, int n, int swaptype_long, int swaptype_int)
+swapfunc(char *a, char *b, size_t n, int swaptype_long, int swaptype_int)
 {
 	if (swaptype_long <= 1)
 		swapcode(long, a, b, n)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705190444.v4J4iEJ1018396>