gbranden pushed a commit to branch master
in repository groff.

commit 5baf1bdfae2d757e5f1be59a24c84719cf59a62f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Apr 10 00:36:10 2026 -0500

    src/roff/troff/env.cpp: Fix code style nits.
    
    * src/roff/troff/env.cpp (add_hyphenation_exception_words_request):
      Assign unsigned literal to array element of type `unsigned char`.
      Explicitly compare value of pointer type to null pointer literal
      instead of letting it pun down to a Boolean.  Parenthesize formally
      complex expressions.
---
 ChangeLog              | 9 +++++++++
 src/roff/troff/env.cpp | 6 +++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 85f32004c..71dc10789 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-04-10  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp
+       (add_hyphenation_exception_words_request): Fix code style nits.
+       Assign unsigned literal to array element of type `unsigned
+       char`.  Explicitly compare value of pointer type to null pointer
+       literal instead of letting it pun down to a Boolean.
+       Parenthesize formally complex expressions.
+
 2026-04-10  G. Branden Robinson <[email protected]>
 
        * src/libs/libgroff/symbol.cpp (symbol::symbol): Fix code style
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index d68531c32..a48edc275 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3950,7 +3950,7 @@ static void add_hyphenation_exception_words_request() // 
.hw
       if (is_word_valid) {
        tok.next();
        if (ci->get_ascii_code() == '-') {
-         if (i > 0 && (npos == 0 || pos[npos - 1] != i))
+         if ((i > 0) && ((npos == 0) || (pos[npos - 1] != i)))
            pos[npos++] = i;
        }
        else {
@@ -3969,7 +3969,7 @@ static void add_hyphenation_exception_words_request() // 
.hw
       }
     }
     if (is_word_valid && (i > 0)) {
-      pos[npos] = 0;
+      pos[npos] = 0U;
       buf[i] = '\0';
       // C++03: new unsigned char[npos + 1]();
       unsigned char *tem = new unsigned char[npos + 1];
@@ -3977,7 +3977,7 @@ static void add_hyphenation_exception_words_request() // 
.hw
       memcpy(tem, pos, npos + 1);
       tem = static_cast<unsigned char *>
            (current_language->exceptions.lookup(symbol(buf), tem));
-      if (tem)
+      if (tem != 0 /* nullptr */)
        delete[] tem;
     }
   }

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

Reply via email to