gbranden pushed a commit to branch master
in repository groff.
commit 5bfc37e27631b1c6f36aa9cc4245cb1fd5d80c4b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 30 05:10:04 2025 -0600
src/roff/troff/input.cpp: Fix code style nit (2).
* src/roff/troff/input.cpp (warnscale_request): Arrange equality
comparisons to avoid inadvertent lvalue assignment.
---
ChangeLog | 3 ++-
src/roff/troff/input.cpp | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7b58d42b0..74bf72950 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
2025-11-30 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (warnscale_request): Fix code style
- nit. Favor value constructors over C-style type casts.
+ nit. Favor value constructors over C-style type casts. Arrange
+ equality comparisons to avoid inadvertent lvalue assignment.
2025-11-30 G. Branden Robinson <[email protected]>
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index eb61e032d..7c8347e3e 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8323,15 +8323,15 @@ void warnscale_request()
return;
}
int c = tok.ch(); // safely compares to char literals; TODO: grochar
- if (c == 'u')
+ if ('u' == c)
warn_scale = 1.0;
- else if (c == 'i')
+ else if ('i' == c)
warn_scale = double(units_per_inch);
- else if (c == 'c')
+ else if ('c' == c)
warn_scale = double(units_per_inch / 2.54);
- else if (c == 'p')
+ else if ('p' == c)
warn_scale = double(units_per_inch / 72.0);
- else if (c == 'P')
+ else if ('P' == c)
warn_scale = double(units_per_inch / 6.0);
else {
warning(WARN_SCALE,
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit