gbranden pushed a commit to branch master
in repository groff.

commit feae192ce6dece3a9c854a4d29906bfeec69b61d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Sep 17 20:20:20 2025 -0500

    [troff]: Refactor `asciify` internals. (3/3)
    
    * src/roff/troff/node.cpp (dbreak_node::asciify)
      (break_char_node::asciify, italic_corrected_node::asciify)
      (left_italic_corrected_node::asciify): Revert (from commit d445aee94e,
      10 September) formerly dead stores nulling out pointers to contained
      nodes.  Since the parent object is no longer deleted, these stores are
      no longer dead, and I expect the nullification to matter when
      asciifying node lists that contain `suppress_node`s.
---
 ChangeLog               | 8 ++++++++
 src/roff/troff/node.cpp | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 5c743a514..61de49f50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,14 @@
        original.  This should be less wasteful of memory, as there's no
        need to carry around node data that is unrepresentable as text
        in an irreversibly transformed macro/string/diversion.
+       * src/roff/troff/node.cpp (dbreak_node::asciify)
+       (break_char_node::asciify, italic_corrected_node::asciify)
+       (left_italic_corrected_node::asciify): Revert (from commit
+       d445aee94e, 10 September) formerly dead stores nulling out
+       pointers to contained nodes.  Since the parent object is no
+       longer deleted, these stores are no longer dead, and I expect
+       the nullification to matter when asciifying node lists that
+       contain `suppress_node`s.
 
 2025-09-18  G. Branden Robinson <[email protected]>
 
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index ce769f11d..c065735c5 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3930,6 +3930,7 @@ void dbreak_node::asciify(macro *m)
   assert(m != 0 /* nullptr */);
   if (m != 0 /* nullptr */)
     asciify_reverse_node_list(m, none);
+  none = 0 /* nullptr */;
 }
 
 void ligature_node::asciify(macro *m)
@@ -3948,6 +3949,7 @@ void break_char_node::asciify(macro *m)
   assert(nodes != 0 /* nullptr */);
   if (nodes != 0 /* nullptr */)
     nodes->asciify(m);
+  nodes = 0 /* nullptr */;
 }
 
 void italic_corrected_node::asciify(macro *m)
@@ -3955,6 +3957,7 @@ void italic_corrected_node::asciify(macro *m)
   assert(nodes != 0 /* nullptr */);
   if (nodes != 0 /* nullptr */)
     nodes->asciify(m);
+  nodes = 0 /* nullptr */;
 }
 
 void left_italic_corrected_node::asciify(macro *m)
@@ -3962,6 +3965,7 @@ void left_italic_corrected_node::asciify(macro *m)
   assert(nodes != 0 /* nullptr */);
   if (nodes != 0 /* nullptr */)
     nodes->asciify(m);
+  nodes = 0 /* nullptr */;
 }
 
 void hmotion_node::asciify(macro *)

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

Reply via email to