gbranden pushed a commit to branch master
in repository groff.
commit 52025b06f50b485ce44647298bccd9ac0e38dde4
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 21 21:58:16 2025 -0600
src/roff/troff/input.cpp: Add assertions (8/10).
* src/roff/troff/input.cpp (do_translate): Add assertions.
---
ChangeLog | 2 +-
src/roff/troff/input.cpp | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 71d738b86..b4f88b0c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,7 @@
(encode_special_character_for_device_output): Invert sense of
test and add assertion.
(token::next): Add assertions to `\z` escape sequence handler.
- (define_character, get_line_arg): Add assertion.
+ (define_character, get_line_arg, do_translate): Add assertions.
(token:description): Split conditional to accommodate assertion.
(encode_special_character_for_device_output): Lift assignment
out of conditional branch since a null pointer check now guards
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index ab1445061..d200306b4 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8375,8 +8375,11 @@ static void do_translate(bool transparently, bool
as_input)
continue;
}
charinfo *ci1 = tok.get_charinfo(true /* required */);
- if (0 /* nullptr */ == ci1)
+ if (0 /* nullptr */ == ci1) {
+ assert(0 == "attempted to use token without charinfo in title"
+ " formatting request");
break;
+ }
tok.next();
if (tok.is_newline() || tok.is_eof()) {
ci1->set_special_translation(charinfo::TRANSLATE_SPACE,
@@ -8397,8 +8400,11 @@ static void do_translate(bool transparently, bool
as_input)
transparently);
else {
charinfo *ci2 = tok.get_charinfo(true /* required */);
- if (0 /* nullptr */ == ci2)
+ if (0 /* nullptr */ == ci2) {
+ assert(0 == "attempted to use token without charinfo in"
+ " character translation request");
break;
+ }
if (ci1 == ci2)
ci1->set_translation(0 /* nullptr */, transparently, as_input);
else
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit