gbranden pushed a commit to branch master
in repository groff.
commit e4435ab5d83bfae3f152899b49a3b0320854c0c9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Nov 19 22:13:19 2025 -0600
[troff]: Trivially refactor.
* src/roff/troff/env.cpp (margin_character): Invert test and resequence
logic to handle the argumentless form of the `mc` request first. This
is to facilitate a forthcoming change.
---
ChangeLog | 7 +++++++
src/roff/troff/env.cpp | 18 +++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7a96e78c5..2dfb2de49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
* src/roff/troff/input.cpp (read_title_parts): Avoid null
pointer dereference.
+2025-11-19 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (margin_character): Trivially refactor.
+ Invert test and resequence logic to handle the argumentless form
+ of the `mc` request first. This is to facilitate a forthcoming
+ change.
+
2025-11-19 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (encode_character_for_device_output):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 663fc1b2a..5f990004f 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1675,7 +1675,15 @@ void margin_character()
{
tok.skip_spaces();
charinfo *ci = tok.get_charinfo();
- if (ci != 0 /* nullptr */) {
+ if (0 /* nullptr */ == ci) { // no argument
+ check_missing_character();
+ curenv->margin_character_flags &= ~environment::MC_ON;
+ if (curenv->margin_character_flags == 0U) {
+ delete curenv->margin_character_node;
+ curenv->margin_character_node = 0 /* nullptr */;
+ }
+ }
+ else {
// Call tok.next() only after making the node so that
// .mc \s+9\(br\s0 works.
node *nd = curenv->make_char_node(ci);
@@ -1690,14 +1698,6 @@ void margin_character()
curenv->margin_character_distance = d;
}
}
- else {
- check_missing_character();
- curenv->margin_character_flags &= ~environment::MC_ON;
- if (curenv->margin_character_flags == 0U) {
- delete curenv->margin_character_node;
- curenv->margin_character_node = 0 /* nullptr */;
- }
- }
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit