You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by jc...@apache.org on 2010/12/29 00:57:40 UTC

svn commit: r1053482 - in /subversion/branches/diff-optimizations-bytes/subversion: include/svn_diff.h libsvn_diff/diff_file.c libsvn_diff/diff_memory.c

Author: jcorvel
Date: Tue Dec 28 23:57:40 2010
New Revision: 1053482

URL: http://svn.apache.org/viewvc?rev=1053482&view=rev
Log:
On the diff-optimizations-bytes branch:

Use apr_size_t instead of int for the array lengths and indices in the newly
added code.

* subversion/include/svn_diff.h
  (svn_diff_fns_t): Use apr_size_t instead of int for datasource_len argument
   of datasources_open function prototype.

* subversion/libsvn_diff/diff_file.c
  (INCREMENT_POINTERS, DECREMENT_POINTERS): Use apr_size_t instead of int for
   local variable i.
  (is_one_at_*, find_identical_*): Use apr_size_t instead of int for file_len
   argument and for local variable i.
  (datasources_open): Use apr_size_t instead of int for datasource_len
   argument and for local variable i.
  
* subversion/libsvn_diff/diff_memory.c
  (datasources_open): Use apr_size_t instead of int for datasource_len
   argument.

Suggested by: stefan2

Modified:
    subversion/branches/diff-optimizations-bytes/subversion/include/svn_diff.h
    subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_file.c
    subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_memory.c

Modified: subversion/branches/diff-optimizations-bytes/subversion/include/svn_diff.h
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/include/svn_diff.h?rev=1053482&r1=1053481&r2=1053482&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/include/svn_diff.h (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/include/svn_diff.h Tue Dec 28 23:57:40 2010
@@ -115,7 +115,7 @@ typedef struct svn_diff_fns_t
   /** Open the datasources of type @a datasources. */
   svn_error_t *(*datasources_open)(void *diff_baton, apr_off_t *prefix_lines,
                                    svn_diff_datasource_e datasource[],
-                                   int datasource_len);
+                                   apr_size_t datasource_len);
 
   /** Close the datasource of type @a datasource. */
   svn_error_t *(*datasource_close)(void *diff_baton,

Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_file.c?rev=1053482&r1=1053481&r2=1053482&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_file.c Tue Dec 28 23:57:40 2010
@@ -254,7 +254,7 @@ datasource_open(void *baton, svn_diff_da
  * curp equal to endp to indicate EOF. */
 #define INCREMENT_POINTERS(all_files, files_len, pool)                       \
   do {                                                                       \
-    int i;                                                                   \
+    apr_size_t i;                                                            \
                                                                              \
     for (i = 0; i < files_len; i++)                                          \
     {                                                                        \
@@ -272,7 +272,7 @@ datasource_open(void *baton, svn_diff_da
  * reached, set chunk to -1 to indicate BOF. */
 #define DECREMENT_POINTERS(all_files, files_len, pool)                       \
   do {                                                                       \
-    int i;                                                                   \
+    apr_size_t i;                                                            \
                                                                              \
     for (i = 0; i < files_len; i++)                                          \
     {                                                                        \
@@ -349,9 +349,9 @@ decrement_chunk(struct file_info *file, 
  * the file (this can happen while scanning backwards). This is the case if
  * one of them has chunk == -1. */
 static svn_boolean_t
-is_one_at_bof(struct file_info *file[], int file_len)
+is_one_at_bof(struct file_info *file[], apr_size_t file_len)
 {
-  int i;
+  apr_size_t i;
 
   for (i = 0; i < file_len; i++)
     if (file[i]->chunk == -1)
@@ -363,9 +363,9 @@ is_one_at_bof(struct file_info *file[], 
 /* Check whether one of the FILEs has its pointers at EOF (this is the case if
  * one of them has curp == endp (this can only happen at the last chunk)) */
 static svn_boolean_t
-is_one_at_eof(struct file_info *file[], int file_len)
+is_one_at_eof(struct file_info *file[], apr_size_t file_len)
 {
-  int i;
+  apr_size_t i;
 
   for (i = 0; i < file_len; i++)
     if (file[i]->curp == file[i]->endp)
@@ -384,12 +384,12 @@ is_one_at_eof(struct file_info *file[], 
  * of the FILEs are set to point at the first byte after the prefix. */
 static svn_error_t *
 find_identical_prefix(svn_boolean_t *reached_one_eof, apr_off_t *prefix_lines,
-                      struct file_info *file[], int file_len,
+                      struct file_info *file[], apr_size_t file_len,
                       apr_pool_t *pool)
 {
   svn_boolean_t had_cr = FALSE;
   svn_boolean_t is_match, reached_all_eof;
-  int i;
+  apr_size_t i;
 
   *prefix_lines = 0;
   for (i = 1, is_match = TRUE; i < file_len; i++)
@@ -472,7 +472,7 @@ find_identical_prefix(svn_boolean_t *rea
  * find_identical_prefix), so we can determine where suffix scanning should 
  * ultimately stop. */
 static svn_error_t *
-find_identical_suffix(struct file_info *file[], int file_len,
+find_identical_suffix(struct file_info *file[], apr_size_t file_len,
                       apr_pool_t *pool)
 {
   struct file_info file_for_suffix[4];
@@ -483,7 +483,7 @@ find_identical_suffix(struct file_info *
   apr_off_t min_file_size;
   int suffix_lines_to_keep = SUFFIX_LINES_TO_KEEP;
   svn_boolean_t is_match, reached_prefix;
-  int i;
+  apr_size_t i;
 
   for (i = 0; i < file_len; i++)
     {
@@ -609,14 +609,14 @@ find_identical_suffix(struct file_info *
 static svn_error_t *
 datasources_open(void *baton, apr_off_t *prefix_lines,
                  svn_diff_datasource_e datasource[],
-                 int datasource_len)
+                 apr_size_t datasource_len)
 {
   svn_diff__file_baton_t *file_baton = baton;
   struct file_info *file[4];
   apr_finfo_t finfo[4];
   apr_off_t length[4];
   svn_boolean_t reached_one_eof;
-  int i;
+  apr_size_t i;
 
   /* Open datasources and read first chunk */
   for (i = 0; i < datasource_len; i++)

Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_memory.c?rev=1053482&r1=1053481&r2=1053482&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_diff/diff_memory.c Tue Dec 28 23:57:40 2010
@@ -100,7 +100,7 @@ datasource_open(void *baton, svn_diff_da
 static svn_error_t *
 datasources_open(void *baton, apr_off_t *prefix_lines,
                  svn_diff_datasource_e datasource[], 
-                 int datasource_len)
+                 apr_size_t datasource_len)
 {
   /* Do nothing: everything is already there and initialized to 0 */
   return SVN_NO_ERROR;