]> pd.if.org Git - pdclib/blobdiff - functions/stdlib/qsort.c
Merged branch stdio_rewrite back into trunk.
[pdclib] / functions / stdlib / qsort.c
index 7fd7c41dc3303ff45052dd5a57c0417a88caf74e..c37760f546fa47a089b913cff22d47e084f7d13f 100644 (file)
@@ -1,7 +1,5 @@
 /* $Id$ */
 
-/* Release $Name$ */
-
 /* qsort( void *, size_t, size_t, int(*)( const void *, const void * ) )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -21,7 +19,7 @@
 */
 
 /* Wrapper for _PDCLIB_memswp protects against multiple argument evaluation. */
-static inline void memswp( char * i, char * j, unsigned int size )
+static inline void memswp( char * i, char * j, size_t size )
 {
     _PDCLIB_memswp( i, j, size );
 }
@@ -43,14 +41,14 @@ void qsort( void * base, size_t nmemb, size_t size, int (*compar)( const void *,
 {
     char * i;
     char * j;
-    size_t thresh     = T * size;
-    char * base_      = (char *)base;
-    char * limit      = base_ + nmemb * size;
+    _PDCLIB_size_t thresh = T * size;
+    char * base_          = (char *)base;
+    char * limit          = base_ + nmemb * size;
     PREPARE_STACK;
 
     for ( ;; )
     {
-        if ( limit - base_ > thresh ) /* QSort for more than T elements. */
+        if ( (size_t)( limit - base_ ) > thresh ) /* QSort for more than T elements. */
         {
             /* We work from second to last - first will be pivot element. */
             i = base_ + size;