gbranden pushed a commit to branch master
in repository groff.
commit 623f92a2efc8feda47b3bfd095c296817688cde1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Apr 30 08:02:14 2024 -0500
[troff]: Fix code style nit.
* src/roff/troff/env.cpp (environment::possibly_break_line): Explicitly
compare variable of pointer type to null pointer constant instead of
letting it pun down to a Boolean.
(environment::print_env): Similarly for testing value of function
returning pointer.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 10 +++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4b975c9de..c320d42f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-30 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (environment::possibly_break_line):
+ (environment::print_env): Explicitly compare variable of pointer
+ type to null pointer constant instead of letting it pun down to
+ a Boolean.
+ (environment::print_env): Similarly for testing value of
+ function returning pointer.
+
2024-04-30 Deri James <[email protected]>
[gropdf] Re-arrange pattern matches.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index ba40f0ba1..f36f9d6e1 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2267,7 +2267,7 @@ void environment::possibly_break_line(bool
must_break_here,
if (!tem->discardable())
first_non_discardable = tem;
node *to_be_discarded;
- if (first_non_discardable) {
+ if (first_non_discardable != 0 /* nullptr */) {
to_be_discarded = first_non_discardable->next;
first_non_discardable->next = 0 /* nullptr */;
for (tem = line; tem != 0 /* nullptr */; tem = tem->next) {
@@ -3448,7 +3448,7 @@ void environment::print_env()
errprint(" font number before underlining: %1\n", pre_underline_fontno);
errprint(" underline spaces: %1\n", underline_spaces ? "yes" : "no");
}
- if (input_trap.contents()) {
+ if (input_trap.contents() != 0 /* nullptr */) {
errprint(" input trap macro: '%1'\n", input_trap.contents());
errprint(" input trap line counter: %1\n", input_trap_count);
errprint(" continued input trap: %1\n",
@@ -3460,8 +3460,8 @@ void environment::print_env()
errprint(" input line start: %1u\n", input_line_start.to_units());
errprint(" line tabs: %1\n", using_line_tabs ? "yes" : "no");
errprint(" discarding: %1\n", discarding ? "yes" : "no");
- errprint(" spread flag set: %1\n", spreading ? "yes" : "no"); // \p
- if (margin_character_node) {
+ errprint(" spread flag set: %1\n", spreading ? "yes" : "no"); // \p
+ if (margin_character_node != 0 /* nullptr */) {
errprint(" margin character flags: %1\n",
margin_character_flags == MARGIN_CHARACTER_ON
? "on"
@@ -3474,7 +3474,7 @@ void environment::print_env()
errprint(" margin character distance: %1u\n",
margin_character_distance.to_units());
}
- if (numbering_nodes) {
+ if (numbering_nodes != 0 /* nullptr */) {
errprint(" line number digit width: %1u\n",
line_number_digit_width.to_units());
errprint(" separation between number and text: %1 digit spaces\n",
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit