gbranden pushed a commit to branch master
in repository groff.
commit cc37fb62d6c39bf926a17cb80b753bf404a0170c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Mar 17 14:52:53 2025 -0500
src/roff/troff/node.cpp: Trivially refactor.
* src/roff/troff/node.cpp: Trivially refactor.
(class hyphen_inhibitor_node): Declare member functions in the same
order as they appear in `struct node`'s declaration; in the latter,
there are many: some are virtual, and some are pure virtual.
(hyphen_inhibitor_node::causes_tprint)
(hyphen_inhibitor_node::is_tag): Define them in the same order, too.
(dbreak_node::add_discretionary_hyphen): Explicitly compare return
value of pointer type to null pointer literal instead of letting it
pun down to a Boolean.
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/node.cpp | 22 +++++++++++-----------
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 64f7cb3c2..92c800b97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-03-17 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp: Trivially refactor.
+ (class hyphen_inhibitor_node): Declare member functions in the
+ same order as they appear in `struct node`'s declaration; in the
+ latter, there are many: some are virtual, and some are pure
+ virtual.
+ (hyphen_inhibitor_node::causes_tprint)
+ (hyphen_inhibitor_node::is_tag): Define them in the same order,
+ too.
+ (dbreak_node::add_discretionary_hyphen): Explicitly compare
+ return value of pointer type to null pointer literal instead of
+ letting it pun down to a Boolean.
+
2025-03-17 G. Branden Robinson <[email protected]>
* src/roff/troff/mtsm.h: Rationalize "#include"s. Include C
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index a0cfe138d..fa7048e80 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2534,10 +2534,10 @@ class hyphen_inhibitor_node : public node {
public:
hyphen_inhibitor_node(node * = 0 /* nullptr */);
node *copy();
- bool is_same_as(node *);
- const char *type();
bool causes_tprint();
bool is_tag();
+ bool is_same_as(node *);
+ const char *type();
hyphenation_type get_hyphenation_type();
};
@@ -2550,24 +2550,24 @@ node *hyphen_inhibitor_node::copy()
return new hyphen_inhibitor_node;
}
-bool hyphen_inhibitor_node::is_same_as(node *)
+bool hyphen_inhibitor_node::causes_tprint()
{
- return true;
+ return false;
}
-const char *hyphen_inhibitor_node::type()
+bool hyphen_inhibitor_node::is_tag()
{
- return "hyphen_inhibitor_node";
+ return false;
}
-bool hyphen_inhibitor_node::causes_tprint()
+bool hyphen_inhibitor_node::is_same_as(node *)
{
- return false;
+ return true;
}
-bool hyphen_inhibitor_node::is_tag()
+const char *hyphen_inhibitor_node::type()
{
- return false;
+ return "hyphen_inhibitor_node";
}
hyphenation_type hyphen_inhibitor_node::get_hyphenation_type()
@@ -2589,7 +2589,7 @@ node *dbreak_node::add_discretionary_hyphen()
node *node::add_discretionary_hyphen()
{
tfont *tf = get_tfont();
- if (!tf)
+ if (0 /* nullptr */ == tf)
return new hyphen_inhibitor_node(this);
if (tf->contains(soft_hyphen_char)) {
color *gcol = get_stroke_color();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit