gbranden pushed a commit to branch master
in repository groff.
commit 7b9e55e8aba54cdedc003ebc718b1531ae579045
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 30 05:31:29 2025 -0600
src/roff/troff/number.cpp: Fix code style nit (1).
* src/roff/troff/number.cpp (is_valid_expression) (is_valid_term):
Parenthesize formally complex expressions.
---
ChangeLog | 6 ++++++
src/roff/troff/number.cpp | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3106da858..d691e01db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-11-30 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/number.cpp (is_valid_expression)
+ (is_valid_term): Fix code style nit. Parenthesize formally
+ complex expressions.
+
2025-11-30 G. Branden Robinson <[email protected]>
* src/roff/troff/number.cpp (is_valid_term): Adjust wording of
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index 1a157ecbd..f5e65f790 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -331,13 +331,13 @@ static bool is_valid_expression(units *u, int
scaling_unit,
*u = u2;
break;
case '=':
- *u = *u == u2;
+ *u = (*u == u2);
break;
case '&':
- *u = *u > 0 && u2 > 0;
+ *u = (*u > 0) && (u2 > 0);
break;
case ':':
- *u = *u > 0 || u2 > 0;
+ *u = (*u > 0) || (u2 > 0);
break;
case '+':
if (ckd_add(u, *u, u2)) {
@@ -404,7 +404,7 @@ static bool is_valid_term(units *u, int scaling_unit,
if (!is_valid_term(u, scaling_unit, is_parenthesized, is_mandatory))
return false;
int tmp, position;
- position = (scaling_unit == 'v'
+ position = ((scaling_unit == 'v')
? curdiv->get_vertical_position().to_units()
: curenv->get_input_line_position().to_units());
if (ckd_sub(&tmp, *u, position)) {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit