gbranden pushed a commit to branch master
in repository groff.

commit 304a72afe197158b77b83005c167a748c62210c9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed May 6 11:30:14 2026 -0500

    src/devices/grops/ps.cpp: Slightly refactor.
    
    * src/devices/grops/ps.cpp (ps_printer::flush_sbuf): Demote local
      variable `space_flag` from `int` to `bool`.  Assign to it using
      Boolean, not integer, literals.  Explicitly construct integer from its
      Boolean value when summing it with other values to compute an array
      index.
---
 ChangeLog                | 8 ++++++++
 src/devices/grops/ps.cpp | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 11d68101c..bfcc35f17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-05-06  G. Branden Robinson <[email protected]>
+
+       * src/devices/grops/ps.cpp (ps_printer::flush_sbuf): Demote
+       local variable `space_flag` from `int` to `bool`.  Assign to it
+       using Boolean, not integer, literals.  Explicitly construct
+       integer from its Boolean value when summing it with other values
+       to compute an array index.
+
 2026-05-06  G. Branden Robinson <[email protected]>
 
        [grops]: Boolify and rename class member variable.
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 8563f5fc8..b3cee09ff 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -1072,7 +1072,7 @@ void ps_printer::flush_sbuf()
     RELATIVE_HV,
     ABSOLUTE
     } motion = NONE;
-  int space_flag = 0;
+  bool space_flag = false;
   if (sbuf_len == 0)
     return;
   if (output_style != sbuf_style) {
@@ -1099,7 +1099,7 @@ void ps_printer::flush_sbuf()
        set_space_code(sbuf_space_code);
        output_space_code = sbuf_space_code;
       }
-      space_flag = 1;
+      space_flag = true;
       extra_space = sbuf_space_width - w - sbuf_kern;
       if (sbuf_space_diff_count > sbuf_space_count/2)
        extra_space++;
@@ -1123,7 +1123,7 @@ void ps_printer::flush_sbuf()
                          'Q', 'R', 'S', 'T'};
   char sym[2];
   sym[0] = command_array[(motion * 4)
-                        + space_flag
+                        + int(space_flag)
                         + (2 * (sbuf_kern != 0))];
   sym[1] = '\0';
   switch (motion) {

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to