svn commit: r318514 - head/lib/libc/stdlib
Xin LI
delphij at FreeBSD.org
Fri May 19 04:44:16 UTC 2017
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)
More information about the svn-src-head
mailing list