You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2005/09/03 16:22:47 UTC

svn commit: r267461 - /apr/apr/trunk/tables/apr_tables.c

Author: wrowe
Date: Sat Sep  3 07:22:43 2005
New Revision: 267461

URL: http://svn.apache.org/viewcvs?rev=267461&view=rev
Log:

  The internal table_mergesort can use entirely unsigned qtys,
  eliminates all type conversion/signedness comparison errors.

Modified:
    apr/apr/trunk/tables/apr_tables.c

Modified: apr/apr/trunk/tables/apr_tables.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/tables/apr_tables.c?rev=267461&r1=267460&r2=267461&view=diff
==============================================================================
--- apr/apr/trunk/tables/apr_tables.c (original)
+++ apr/apr/trunk/tables/apr_tables.c Sat Sep  3 07:22:43 2005
@@ -962,7 +962,8 @@
 }
 
 static apr_table_entry_t **table_mergesort(apr_pool_t *pool,
-                                           apr_table_entry_t **values, int n)
+                                           apr_table_entry_t **values, 
+                                           apr_size_t n)
 {
     /* Bottom-up mergesort, based on design in Sedgewick's "Algorithms
      * in C," chapter 8
@@ -970,7 +971,7 @@
     apr_table_entry_t **values_tmp =
         (apr_table_entry_t **)apr_palloc(pool, n * sizeof(apr_table_entry_t*));
     apr_size_t i;
-    int blocksize;
+    apr_size_t blocksize;
 
     /* First pass: sort pairs of elements (blocksize=1) */
     for (i = 0; i + 1 < n; i += 2) {
@@ -985,7 +986,7 @@
     blocksize = 2;
     while (blocksize < n) {
         apr_table_entry_t **dst = values_tmp;
-        int next_start;
+        apr_size_t next_start;
         apr_table_entry_t **swap;
 
         /* Merge consecutive pairs blocks of the next blocksize.
@@ -995,10 +996,10 @@
         for (next_start = 0; next_start + blocksize < n;
              next_start += (blocksize + blocksize)) {
 
-            int block1_start = next_start;
-            int block2_start = block1_start + blocksize;
-            int block1_end = block2_start;
-            int block2_end = block2_start + blocksize;
+            apr_size_t block1_start = next_start;
+            apr_size_t block2_start = block1_start + blocksize;
+            apr_size_t block1_end = block2_start;
+            apr_size_t block2_end = block2_start + blocksize;
             if (block2_end > n) {
                 /* The last block may be smaller than blocksize */
                 block2_end = n;