svn commit: r1934522 - subversion/trunk/subversion/libsvn_diff

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <177948614442.2257293.12011261911679770615@svn03-he-fi>
Author: ivan
Date: Fri May 22 21:42:24 2026
New Revision: 1934522

Log:
Use inline functions instead of macros to have explicit argument and return
type.

The offset_in_chunk() should return apr_size_t instead of apr_off_t: I am
going to fix this in separate commit.

* subversion/libsvn_diff/diff_file.c
  (chunk_to_offset, offset_to_chunk, offset_in_chunk): Convert to inline
   functions.

Modified:
   subversion/trunk/subversion/libsvn_diff/diff_file.c

Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_file.c	Fri May 22 20:02:50 2026	(r1934521)
+++ subversion/trunk/subversion/libsvn_diff/diff_file.c	Fri May 22 21:42:24 2026	(r1934522)
@@ -130,10 +130,23 @@ datasource_to_index(svn_diff_datasource_
 #define CHUNK_SHIFT 17
 #define CHUNK_SIZE (1 << CHUNK_SHIFT)
 
-#define chunk_to_offset(chunk) ((chunk) << CHUNK_SHIFT)
-#define offset_to_chunk(offset) ((offset) >> CHUNK_SHIFT)
-#define offset_in_chunk(offset) ((offset) & (CHUNK_SIZE - 1))
+static APR_INLINE apr_off_t
+chunk_to_offset(apr_off_t chunk)
+{
+  return chunk << CHUNK_SHIFT;
+}
 
+static APR_INLINE apr_off_t
+offset_to_chunk(apr_off_t offset)
+{
+  return offset >> CHUNK_SHIFT;
+}
+
+static APR_INLINE apr_off_t
+offset_in_chunk(apr_off_t offset)
+{
+  return offset & (CHUNK_SIZE - 1);
+}
 
 /* Read a chunk from a FILE into BUFFER, starting from OFFSET, going for
  * *LENGTH.  The actual bytes read are stored in *LENGTH on return.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.