gbranden pushed a commit to branch master
in repository groff.

commit 0863501486e6968ec6ece522ca849c3354259106
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 7 02:19:02 2024 -0500

    [troff]: Fix code style nits.
    
    * src/roff/troff/input.cpp (temp_iterator::temp_iterator): Explicitly
      cast return value of `memcpy()` to `void`.
    
      (make_temp_iterator): Reorder comparison with null pointer to avoid
      inadvertent lvalue assignment.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad82c3893..8aba5f2d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-07  G. Branden Robinson <[email protected]>
+
+       [troff]: Fix code style nits.
+
+       * src/roff/troff/input.cpp (temp_iterator::temp_iterator):
+       Explicitly cast return value of `memcpy()` to `void`.
+       (make_temp_iterator): Reorder comparison with null pointer to
+       avoid inadvertent lvalue assignment.
+
 2024-08-07  G. Branden Robinson <[email protected]>
 
        [troff]: Fix Savannah #66052 (2/2).
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 50ec6a334..0d6e4e09a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3751,7 +3751,7 @@ temp_iterator::temp_iterator(const char *s, int len)
 {
   if (len > 0) {
     base = new unsigned char[len + 1];
-    memcpy(base, s, len);
+    (void) memcpy(base, s, len);
     base[len] = '\0';
     ptr = base;
     eptr = base + len;
@@ -3766,7 +3766,7 @@ temp_iterator::~temp_iterator()
 
 input_iterator *make_temp_iterator(const char *s)
 {
-  if (s == 0)
+  if (0 /* nullptr */ == s)
     return new temp_iterator(s, 0);
   else {
     size_t n = strlen(s);

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

Reply via email to