master 90f25503d81 3/4: Refactor replace-region-contents init

Pip Cet via Mailing list for Emacs changes <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 90f25503d8145fc94b9a500d93332ae6fc35f6b8
Author: Paul Eggert <[email protected]>
Commit: Pip Cet <[email protected]>

    Refactor replace-region-contents init
    
    * src/editfns.c (Freplace_region_contents):
    Make it more obvious that everything fits.
---
 src/editfns.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index 78f60ca1da5..31bf911a8be 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2099,14 +2099,14 @@ a buffer or a string.  But this is deprecated.  */)
      comparison dramatically in multibyte buffers.  */
   int *chars_a = (int *) (((uintptr_t) (buffer + 2 * diags) + align_bytes)
 			  & ~align_bytes);
-  for (ptrdiff_t p = min_a; p < min_a + size_a; p++)
-    chars_a[p - min_a]
-      = BUF_FETCH_CHAR_AS_MULTIBYTE (a, buf_charpos_to_bytepos (a, p));
+  for (ptrdiff_t i = 0; i < size_a; i++)
+    chars_a[i]
+      = BUF_FETCH_CHAR_AS_MULTIBYTE (a, buf_charpos_to_bytepos (a, min_a + i));
 
   int *chars_b = chars_a + size_a;
-  for (ptrdiff_t p = min_b; p < min_b + size_b; p++)
-    chars_b[p - min_b]
-      = BUF_FETCH_CHAR_AS_MULTIBYTE (b, buf_charpos_to_bytepos (b, p));
+  for (ptrdiff_t i = 0; i < size_b; i++)
+    chars_b[i]
+      = BUF_FETCH_CHAR_AS_MULTIBYTE (b, buf_charpos_to_bytepos (b, min_b + i));
 
   unsigned char *deletions_insertions = memset (chars_b + size_b, 0,
 						del_bytes + ins_bytes);
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.