apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r279646 - /apr/apr/branches/1.2.x/tables/apr_tables.c
Date Thu, 08 Sep 2005 21:38:19 GMT
Author: wrowe
Date: Thu Sep  8 14:38:06 2005
New Revision: 279646

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

  Backport rev267461

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


Modified:
    apr/apr/branches/1.2.x/tables/apr_tables.c

Modified: apr/apr/branches/1.2.x/tables/apr_tables.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/tables/apr_tables.c?rev=279646&r1=279645&r2=279646&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/tables/apr_tables.c (original)
+++ apr/apr/branches/1.2.x/tables/apr_tables.c Thu Sep  8 14:38:06 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;



Mime
View raw message