gbranden pushed a commit to branch master
in repository groff.

commit c96469ff68834309e37eaa4e38773e052b4eb613
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 15 06:33:12 2026 -0500

    src/roff/troff/node.cpp: Refactor (3/3).
    
    ...some gro(h)t(ml)esquerie.
    
    * src/roff/troff/node.cpp (suppress_node::tprint): Refactor code
      populating "grohtml-info" output to access the contents of built-in
      registers `.F` and `.c` directly via their `get_string()` member
      functions instead of this file's `get_string()` function, which
      syntactically sugars that procedure.
    
      (get_string): Delete now-unused function.
---
 ChangeLog               | 10 ++++++++++
 src/roff/troff/node.cpp | 17 +++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b8fefc38f..fe76ec0c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-04-15  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp (suppress_node::tprint): Refactor code
+       populating "grohtml-info" output to access the contents of
+       built-in registers `.F` and `.c` directly via their
+       `get_string()` member functions instead of this file's
+       `get_string()` function, which syntactically sugars that
+       procedure.
+       (get_string): Delete now-unused function.
+
 2026-04-15  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (suppress_node::tprint): Refactor code
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 06e09fb6a..bce2d3098 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4612,16 +4612,6 @@ int tag_node::ends_sentence()
   return 2;
 }
 
-// Get contents of register `p` as string.
-// Used only by suppress_node::tprint().
-static const char *get_string(const char *p)
-{
-  assert(p != 0 /* nullptr */);
-  reg *r = static_cast<reg *>(register_dictionary.lookup(p));
-  assert(r != 0 /* nullptr */);
-  return r->get_string();
-}
-
 void suppress_node::put(troff_output_file *out, const char *s)
 {
   int i = 0;
@@ -4787,8 +4777,11 @@ void suppress_node::tprint(troff_output_file *out)
                topdiv->get_page_number(),
                opminx, opminy, opmaxx, opmaxy,
                page_width,
-               name, hresolution, vresolution, get_string(".F"),
-               get_string(".c"));
+               name, hresolution, vresolution,
+               static_cast<reg *>(register_dictionary.lookup(".F"))
+                   ->get_string(),
+               static_cast<reg *>(register_dictionary.lookup(".c"))
+                   ->get_string());
        fflush(stderr);
       }
     }

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

Reply via email to