gbranden pushed a commit to branch master
in repository groff.
commit e1aae13b1b1f247c99e2d065c3b18ae0f081a95c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Nov 28 19:25:16 2025 -0600
[troff]: Modestly refactor (5/8).
* src/roff/troff/input.cpp (get_line_arg): Construct integer from
character literal.
---
ChangeLog | 1 +
src/roff/troff/input.cpp | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2bdd6cf61..5dd452f2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* src/roff/troff/env.cpp (configure_tab_stops_request):
* src/roff/troff/number.cpp (get_incr_number)
(is_valid_expression, is_valid_term):
+ * src/roff/troff/input.cpp (get_line_arg):
Construct integer from character literal.
* src/roff/troff/env.cpp (adjust):
* src/roff/troff/reg.cpp (assign_register_format_request):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 193dca70e..abafce8d1 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6016,31 +6016,31 @@ static bool get_line_arg(units *n, unsigned char si,
charinfo **cip)
static bool read_size(int *x) // \s
{
tok.next();
- int c = tok.ch();
+ int c = tok.ch(); // safely compares to char literals; TODO: grochar
int inc = 0;
- if (c == '-') {
+ if (c == int('-')) { // TODO: grochar
inc = -1;
tok.next();
c = tok.ch();
}
- else if (c == '+') {
+ else if (c == int('+')) { // TODO: grochar
inc = 1;
tok.next();
c = tok.ch();
}
int val = 0; // pacify compiler
bool contains_invalid_digit = false;
- if (c == '(') {
+ if (c == int('(')) { // TODO: grochar
tok.next();
c = tok.ch();
if (!inc) {
// allow an increment either before or after the left parenthesis
- if (c == '-') {
+ if (c == int('-')) { // TODO: grochar
inc = -1;
tok.next();
c = tok.ch();
}
- else if (c == '+') {
+ else if (c == int('+')) { // TODO: grochar
inc = 1;
tok.next();
c = tok.ch();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit