texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * info/window.c (collect_line_starts): add a comm


From: Patrice Dumas
Subject: branch master updated: * info/window.c (collect_line_starts): add a comment to explain that there is a comparison of unsigned and signed integers.
Date: Thu, 10 Oct 2024 16:05:13 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ac213c00bc * info/window.c (collect_line_starts): add a comment to 
explain that there is a comparison of unsigned and signed integers.
ac213c00bc is described below

commit ac213c00bccba831cecdd6abce1967d21f71073d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Oct 10 22:04:58 2024 +0200

    * info/window.c (collect_line_starts): add a comment to explain that
    there is a comparison of unsigned and signed integers.
---
 ChangeLog     | 5 +++++
 info/window.c | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8e8474f4c4..53fd44a234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-10  Patrice Dumas  <pertusus@free.fr>
+
+       * info/window.c (collect_line_starts): add a comment to explain that
+       there is a comparison of unsigned and signed integers.
+
 2024-10-10  Patrice Dumas  <pertusus@free.fr>
 
        * info/t/Init-test.inc: modify proposed valgrind call in comment to
diff --git a/info/window.c b/info/window.c
index 8e63776bb4..407494c175 100644
--- a/info/window.c
+++ b/info/window.c
@@ -1109,6 +1109,14 @@ text_buffer_to_node (struct text_buffer *tb)
 static void
 collect_line_starts (WINDOW *win, long ll_num, long pl_start)
 {
+  /* in the following macro call, win->line_count, a signed long is
+     compared to win->line_slots an unsigned size_t.  The comparison
+     should be ok as win->line_count should always be positive.
+     win->line_count is also increased, so using an intermediary
+     variable to explicit the conversion is not practical.  The comparison
+     may lead to a compile time warning like
+      comparison of integer expressions of different signedness
+    */
   add_element_to_array (pl_start, win->line_count,
                         win->line_starts, win->line_slots, 2);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]