gbranden pushed a commit to branch master
in repository groff.

commit 884a78589ab0717a74b55c1dd59efc63be13503f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Apr 30 09:12:07 2024 -0500

    [troff]: Fix code style nit (`NULL` -> `0`).
    
    * src/roff/troff/div.cpp (page_number):
    * src/roff/troff/env.cpp (environment::add_node)
      (environment::construct_state):
    * src/roff/troff/input.cpp (psbb_locator::psbb_locator)
      (psbb_locator::parse_bounding_box, psbb_locator::get_line)
      (psbb_locator::context_args, psbb_locator::get_header_comment)
      (psbb_locator::skip_to_trailer): Use idiomatic C++98 null pointer
      constant literal.
---
 ChangeLog                | 11 +++++++++++
 src/roff/troff/div.cpp   |  2 +-
 src/roff/troff/env.cpp   |  4 ++--
 src/roff/troff/input.cpp | 29 +++++++++++++++--------------
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 04a617346..8e26a7ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-04-30  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/div.cpp (page_number):
+       * src/roff/troff/env.cpp (environment::add_node)
+       (environment::construct_state):
+       * src/roff/troff/input.cpp (psbb_locator::psbb_locator)
+       (psbb_locator::parse_bounding_box, psbb_locator::get_line)
+       (psbb_locator::context_args, psbb_locator::get_header_comment)
+       (psbb_locator::skip_to_trailer): Use idiomatic C++98 null
+       pointer constant literal.
+
 2024-04-30  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp (environment::print_env): Revise
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index cb508b322..83f10e7bc 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -850,7 +850,7 @@ void page_number()
   // XXX: Yuck!  Get rid of this; macro packages already test the
   // register before invoking .pn.
   reg *r = (reg *)register_dictionary.lookup("ps4html");
-  if (r == NULL)
+  if (r == 0 /* nullptr */)
     if (has_arg() && get_integer(&n, topdiv->get_page_number()))
       topdiv->set_next_page_number(n);
   skip_line();
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 276042a48..166af81d6 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -358,7 +358,7 @@ void environment::add_node(node *nd)
   if (nd == 0 /* nullptr */)
     return;
   if (!suppress_push) {
-    if (nd->is_special && nd->state == NULL)
+    if (nd->is_special && nd->state == 0 /* nullptr */)
       nd->state = construct_state(false);
     nd->push_state = get_diversion_state();
   }
@@ -2420,7 +2420,7 @@ statem *environment::construct_state(bool has_only_eol)
     return s;
   }
   else
-    return NULL;
+    return 0 /* nullptr */;
 }
 
 void environment::construct_format_state(node *nd, bool was_centered,
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 82fb477b3..09b25f7cd 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6405,9 +6405,9 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
       // specify a %%BoundingBox comment; locate it, initially
       // expecting to find it in the comments header...
       //
-      const char *context = NULL;
-      while ((context == NULL) && get_header_comment()) {
-       if ((context = bounding_box_args()) != NULL) {
+      const char *context = 0 /* nullptr */;
+      while ((context == 0 /* nullptr */) && get_header_comment()) {
+       if ((context = bounding_box_args()) != 0 /* nullptr */) {
 
          // When the "%%BoundingBox" comment is found, it may simply
          // specify the bounding box property values, or it may defer
@@ -6420,10 +6420,10 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
            // for the appropriate specification within it.
            //
            if (skip_to_trailer() > 0) {
-             while ((context = bounding_box_args()) == NULL
+             while ((context = bounding_box_args()) == 0 /* nullptr */
                     && get_line(DSC_LINE_MAX_ENFORCE) > 0)
                ;
-             if (context != NULL) {
+             if (context != 0 /* nullptr */) {
                //
                // When we find a bounding box specification here...
                //
@@ -6440,7 +6440,7 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
              // The trailer could not be found, so there is no context in
              // which a trailing %%BoundingBox comment might be located.
              //
-             context = NULL;
+             context = 0 /* nullptr */;
          }
          if (status == PSBB_RANGE_IS_BAD) {
            //
@@ -6453,7 +6453,7 @@ filename(fname), llx(0), lly(0), urx(0), ury(0), 
lastc(EOF)
          }
        }
       }
-      if (context == NULL)
+      if (context == 0 /* nullptr */)
        //
        // Conversely, this arises when no value specifying %%BoundingBox
        // comment has been found, in any appropriate location...
@@ -6518,7 +6518,7 @@ int psbb_locator::parse_bounding_box(const char *context)
       // ...before checking for "(atend)", and setting the
       // appropriate exit status accordingly.
       //
-      status = (context_args("(atend)", context) == NULL)
+      status = (context_args("(atend)", context) == 0 /* nullptr */)
                 ? llx = lly = urx = ury = PSBB_RANGE_IS_BAD
                 : PSBB_RANGE_AT_END;
     }
@@ -6612,7 +6612,7 @@ int psbb_locator::get_line(int dscopt)
 //
 // Returns a pointer to the trailing substring of the current
 // input line, following an initial substring matching the "tag"
-// argument, or NULL if "tag" is not matched.
+// argument, or 0 if "tag" is not matched.
 //
 inline const char *psbb_locator::context_args(const char *tag)
 {
@@ -6631,19 +6631,19 @@ inline const char *psbb_locator::context_args(const 
char *tag)
 //
 // Returns a pointer to the trailing substring of the specified
 // text buffer, following an initial substring matching the "tag"
-// argument, or NULL if "tag" is not matched.
+// argument, or 0 if "tag" is not matched.
 //
 inline const char *psbb_locator::context_args(const char *tag, const char *p)
 {
   size_t len = strlen(tag);
-  return (strncmp(tag, p, len) == 0) ? p + len : NULL;
+  return (strncmp(tag, p, len) == 0) ? p + len : 0 /* nullptr */;
 }
 
 // psbb_locator::bounding_box_args()
 //
 // Returns a pointer to the arguments string, within the current
 // input line, when this represents a PostScript "%%BoundingBox:"
-// comment, or NULL otherwise.
+// comment, or 0 otherwise.
 //
 inline const char *psbb_locator::bounding_box_args(void)
 {
@@ -6684,7 +6684,7 @@ inline bool psbb_locator::get_header_comment(void)
 
     // Finally, the input line must not say "%%EndComments".
     //
-    && context_args("%%EndComments") == NULL;
+    && context_args("%%EndComments") == 0 /* nullptr */;
 }
 
 // psbb_locator::skip_to_trailer()
@@ -6723,7 +6723,8 @@ inline int psbb_locator::skip_to_trailer(void)
           // ...until we either exhaust the available stream data, or
           // we have located a "%%Trailer" comment line.
           //
-        } while ((status != 0) && (context_args("%%Trailer") == NULL));
+        } while ((status != 0)
+                 && (context_args("%%Trailer") == 0 /* nullptr */));
       if (status > 0)
        //
        // We found the "%%Trailer" comment, so we may immediately

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

Reply via email to