groff-commit
[Top][All Lists]
Advanced

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

[groff] 21/26: src/roff/troff/input.cpp: Fix code style nits.


From: G. Branden Robinson
Subject: [groff] 21/26: src/roff/troff/input.cpp: Fix code style nits.
Date: Thu, 14 Nov 2024 11:54:12 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 826b8b76b0ac720a7c864865092979c05272bbd2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 13 13:55:13 2024 -0600

    src/roff/troff/input.cpp: Fix code style nits.
    
    * src/roff/troff/input.cpp (lookup_request): Use C++ `static_cast`
      operator instead of C-style type cast.  Reorder equality comparison to
      avoid inadvertent lvalue assignment.
---
 ChangeLog                | 6 ++++++
 src/roff/troff/input.cpp | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 537ac5c1a..cab0af86c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-11-13  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (lookup_request): Use C++
+       `static_cast` operator instead of C-style type cast.  Reorder
+       equality comparison to avoid inadvertent lvalue assignment.
+
 2024-11-12  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (do_source, do_macro_source):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 7822d5d55..17f30fdd9 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -9371,8 +9371,9 @@ void init_request(const char *s, REQUEST_FUNCP f)
 static request_or_macro *lookup_request(symbol nm)
 {
   assert(!nm.is_null());
-  request_or_macro *p = (request_or_macro *)request_dictionary.lookup(nm);
-  if (p == 0) {
+  request_or_macro *p
+    = static_cast<request_or_macro *>(request_dictionary.lookup(nm));
+  if (0 /* nullptr */ == p) {
     warning(WARN_MAC, "macro '%1' not defined", nm.contents());
     p = new macro;
     request_dictionary.define(nm, p);



reply via email to

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