gbranden pushed a commit to branch master
in repository groff.

commit 1e96124d84a0a94064cf5134e9bd3860a93b454b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 23 15:18:51 2025 -0600

    [troff]: Produce real nodes in place of tag nodes.
    
    This change is pretty deep in the weeds of GNU troff's internal API.  It
    should produce no perceptible behavior change (all tests pass).
    
    * src/roff/troff/env.cpp (environment::make_tag): When not formatting
      HTML, return a new transparent dummy node instead of a null pointer.
      When this function was implemented in 2001-2004, the decision to
      return a null pointer violated an (undocumented, possibly
      uncontemplated) invariant that `environment::add_node()` was never
      passed a null pointer.  By a returning an actual object, we can
      restore that invariant.
---
 ChangeLog              | 10 ++++++++++
 src/roff/troff/env.cpp |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 57a16cb80..8e5a36776 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-11-23  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp (environment::make_tag): When not
+       formatting HTML, return a new transparent dummy node instead of
+       a null pointer.  When this function was implemented in
+       2001-2004, the decision to return a null pointer violated an
+       {undocumented, possibly uncontemplated} invariant that
+       `environment::add_node()` was never passed a null pointer.  By a
+       returning an actual object, we can restore that invariant.
+
 2025-11-23  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp: Fix code style nits.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 8b1bb0c9e..0a813271c 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2467,7 +2467,7 @@ node *environment::make_tag(const char *nm, int i)
     m.append_int(i);
     return new device_extension_node(m);
   }
-  return 0 /* nullptr */;
+  return new transparent_dummy_node;
 }
 
 void environment::dump_troff_state()

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

Reply via email to