gbranden pushed a commit to branch master
in repository groff.
commit aaa396d11eaa2bf05d37fd4a4b6861fe9c0c6f0e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 14 11:43:44 2024 -0500
[troff]: Slightly refactor (boolify token class).
[troff]: Boolify remaining `token` class member functions that need it.
* src/roff/troff/token.h (class token): Demote declarations of
`operator==`, `operator!=`, `add_to_zero_width_node_list`.
* src/roff/troff/input.cpp (token::operator==, token::operator!=)
(token::add_to_zero_width_node_list): Do it.
---
ChangeLog | 10 ++++++++++
src/roff/troff/input.cpp | 14 +++++++-------
src/roff/troff/token.h | 6 +++---
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aae3db6d0..ff1d974b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-08-14 G. Branden Robinson <[email protected]>
+
+ [troff]: Boolify remaining `token` class member functions that
+ need it.
+
+ * src/roff/troff/token.h (class token): Demote declarations of
+ `operator==`, `operator!=`, `add_to_zero_width_node_list`.
+ * src/roff/troff/input.cpp (token::operator==)
+ (token::operator!=, token::add_to_zero_width_node_list): Do it.
+
2024-08-14 G. Branden Robinson <[email protected]>
[troff]: Throw diagnostic in event of a diversion's contents
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index a30c4c844..3eae78e68 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2475,10 +2475,10 @@ void token::next()
}
}
-int token::operator==(const token &t)
+bool token::operator==(const token &t)
{
if (type != t.type)
- return 0;
+ return false;
switch (type) {
case TOKEN_CHAR:
return c == t.c;
@@ -2487,11 +2487,11 @@ int token::operator==(const token &t)
case TOKEN_NUMBERED_CHAR:
return val == t.val;
default:
- return 1;
+ return true;
}
}
-int token::operator!=(const token &t)
+bool token::operator!=(const token &t)
{
return !(*this == t);
}
@@ -7575,7 +7575,7 @@ void check_missing_character()
// this is for \Z
-int token::add_to_zero_width_node_list(node **pp)
+bool token::add_to_zero_width_node_list(node **pp)
{
hunits w;
int s;
@@ -7636,13 +7636,13 @@ int token::add_to_zero_width_node_list(node **pp)
n->is_escape_colon();
break;
default:
- return 0;
+ return false;
}
if (n) {
n->next = *pp;
*pp = n;
}
- return 1;
+ return true;
}
void token::process()
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index eb94873ae..68a25a261 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -88,11 +88,11 @@ public:
bool is_page_ejector();
bool is_hyphen_indicator();
bool is_zero_width_break();
- int operator==(const token &); // need this for delimiters, and for
conditions
- int operator!=(const token &); // ditto
+ bool operator==(const token &); // need this for delimiters, and for
conditions
+ bool operator!=(const token &); // ditto
unsigned char ch();
charinfo *get_char(bool = false);
- int add_to_zero_width_node_list(node **);
+ bool add_to_zero_width_node_list(node **);
void make_space();
void make_newline();
const char *description();
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit