gbranden pushed a commit to branch master
in repository groff.

commit 21a1d3f0dd4bd87e3e071f833fa1cd4225a84234
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Nov 22 10:08:40 2025 -0600

    src/roff/troff/node.cpp: Adjust rfschar behavior.
    
    * src/roff/troff/node.cpp (remove_font_specific_character): When
      processing arguments to the `rfschar` request, proceed to the next
      token (instead of skipping the remainder of the input line) if the
      font-specific character to be removed already doesn't exist as such.
      `rfschar` now better aligns with what `cflags` and `rchar` do.
---
 ChangeLog               |  4 +++-
 src/roff/troff/node.cpp | 12 +++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8e9f5e0c6..c0c8ce19c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,7 +6,9 @@
        has a null pointer to its `charinfo`), and the build used
        `NDEBUG` to suppress assertions, skip the character and process
        the next token (if any) instead of ignoring the rest of the
-       input line, as the `cflags` and `rchar` requests do.
+       input line.  Also proceed to the next token if the font-specific
+       character to be removed already doesn't exist as such.
+       `rfschar` now better aligns with what `cflags` and `rchar` do.
 
 2025-11-19  G. Branden Robinson <[email protected]>
 
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 6775d7a2d..1370d7473 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7059,11 +7059,13 @@ static void remove_font_specific_character()
          gl += s->nm.contents();
          gl += '\0';
          charinfo *ci = lookup_charinfo(symbol(gl.contents()));
-         if (0 /* nullptr */ == ci)
-           break;
-         macro *m = ci->set_macro(0 /* nullptr */);
-         if (m != 0 /* nullptr */)
-           delete m;
+         // Expect a null pointer if the font-specific character was
+         // already removed or never existed.
+         if (ci != 0 /* nullptr */) {
+           macro *m = ci->set_macro(0 /* nullptr */);
+           if (m != 0 /* nullptr */)
+             delete m;
+         }
        }
       }
       tok.next();

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

Reply via email to