gbranden pushed a commit to branch master
in repository groff.
commit 13c587cc3e6927c45618af9ca045f937a3aaa10f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 20 17:04:28 2026 -0600
src/devices/grotty/tty.cpp: Fix code style nit.
* src/devices/grotty/tty.cpp (tty_printer::add_char): Explicitly compare
variable of pointer type to ISO C++98 null pointer literal, instead of
punning it down to a Boolean.
Also annotate null pointer literal with `nullptr` comment to ease any
future transition to C++11, which defines it as a keyword.
---
ChangeLog | 6 ++++++
src/devices/grotty/tty.cpp | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e376b7085..9c4603ddd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,12 @@
description file. This scenario is a fatal error but a valid
scenario.
+2026-11-20 G. Branden Robinson <[email protected]>
+
+ * src/devices/grotty/tty.cpp (tty_printer::add_char): Explicitly
+ compare variable of pointer type to ISO C++98 null pointer
+ literal, instead of punning it down to a Boolean.
+
2026-11-20 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp (environment::dump): Rearrange report
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 616d6bcf9..b7d0cbfc1 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -470,7 +470,9 @@ void tty_printer::add_char(output_character c, int w,
// at each hpos, and otherwise in order of occurrence.
tty_glyph **pp;
- for (pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
+ for (pp = lines + (vpos - 1);
+ *pp != 0 /* nullptr */;
+ pp = &(*pp)->next)
if ((*pp)->hpos < hpos
|| ((*pp)->hpos == hpos && (*pp)->order() >= g->order()))
break;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit