gbranden pushed a commit to branch master
in repository groff.

commit da51c86c1ad31c99a77d77e75b6c7acec8894408
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue May 5 03:52:37 2026 -0500

    [troff]: Fix code style nits.
    
    * src/roff/troff/input.cpp
      (read_character_in_escape_sequence_parameter): Arrange equality
      comparisons to avoid inadvertent lvalue assignment.  Return explicitly
      constructed `char` object from an `int` value rather than relying upon
      "the default conversions" of C and C++.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 8 +++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9dda61905..c06afad3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-05-05  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp
+       (read_character_in_escape_sequence_parameter): Fix code style
+       nits.  Arrange equality comparisons to avoid inadvertent lvalue
+       assignment.  Return explicitly constructed `char` object from
+       an `int` value rather than relying upon "the default
+       conversions" of C and C++.
+
 2026-05-05  G. Branden Robinson <[email protected]>
 
        Correct some highly outdated Microsoft DOS/Windows port stuff.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 51e344364..b192b0526 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1024,16 +1024,18 @@ static char read_character_in_escape_sequence_parameter(
   case EOF:
     copy_mode_error("end of input in escape sequence");
     return '\0';
+  // XXX: This is a bit unorthodox, and maybe too clever.
   default:
     if (!is_invalid_input_char(c))
       break;
     // fall through
+  // We now have to test `c` again due to the `default:` above.
   case '\n':
-    if (c == '\n')
+    if ('\n' == c)
       input_stack::push(make_temp_iterator("\n"));
     // fall through
   case ' ':
-    if (c == ' ' && allow_space)
+    if ((' ' == c) && allow_space)
       break;
     // fall through
   case '\t':
@@ -1043,7 +1045,7 @@ static char read_character_in_escape_sequence_parameter(
                    input_char_description(c));
     return '\0';
   }
-  return c;
+  return char(c);
 }
 
 static symbol read_two_character_escape_sequence_parameter()

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

Reply via email to