gbranden pushed a commit to branch master
in repository groff.
commit 1db3302eaba9af69693111b06d5473efd127fe57
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 21 21:48:45 2025 -0600
[troff]: Slightly refactor.
* src/roff/troff/input.cpp (read_title_parts): Lift return value of
repeated `tok.get_charinfo()` function call into a local variable,
`ci`.
---
ChangeLog | 6 ++++++
src/roff/troff/input.cpp | 10 +++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3ee216948..dbbc0ca1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-11-21 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (read_title_parts): Slightly
+ refactor. Lift return value of repeated `tok.get_charinfo()`
+ function call into a local variable, `ci`.
+
2025-11-21 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (token::description): Report the node
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 930a84566..a43ea2885 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6289,9 +6289,13 @@ void read_title_parts(node **part, hunits *part_width)
tok.next();
break;
}
- if ((page_character != 0 /* nullptr */)
- && (tok.get_charinfo() != 0 /* nullptr */)
- && (tok.get_charinfo() == page_character))
+ charinfo *ci = tok.get_charinfo();
+ // It's okay for `ci` to be a null pointer; that will be the case
+ // if the token is a node: italic corrections, horizontal motions,
+ // and so forth. TODO: Is it worth warning about some node types?
+ if ((ci != 0 /* nullptr */)
+ && (page_character != 0 /* nullptr */)
+ && (page_character == ci))
interpolate_register(percent_symbol, 0);
else
tok.process();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit