gbranden pushed a commit to branch master
in repository groff.
commit 4a1898b70ed550c1c088fd6281fe4672de82a5d1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jul 25 15:17:37 2024 -0500
[troff]: Slightly refactor.
* src/roff/troff/env.cpp (line_length, title_length): Drop use of
needless temporary variable `minimum_length`. Use global variable
`hresolution` instead of static class member variable `font::hor`.
Clarify wording of warning diagnostic message when (title) line length
invalid.
---
ChangeLog | 8 ++++++++
src/roff/troff/env.cpp | 20 ++++++++++----------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eb4ea86d1..79882167f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-07-25 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (line_length, title_length): Drop use
+ of needless temporary variable `minimum_length`. Use global
+ variable `hresolution` instead of static class member variable
+ `font::hor`. Clarify wording of warning diagnostic message when
+ {title} line length invalid.
+
2024-07-20 G. Branden Robinson <[email protected]>
* src/utils/grog/grog.pl (interpret_line): Fix logic error; set
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 5186f987e..6c443a3a9 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1433,12 +1433,12 @@ void right_justify()
void line_length()
{
hunits temp;
- hunits minimum_length = font::hor;
if (has_arg() && get_hunits(&temp, 'm', curenv->line_length)) {
- if (temp < minimum_length) {
- warning(WARN_RANGE, "invalid line length %1u rounded to device"
- " horizontal motion quantum", temp.to_units());
- temp = minimum_length;
+ if (temp < hresolution) {
+ warning(WARN_RANGE, "setting invalid line length %1u to device"
+ " horizontal motion quantum",
+ temp.to_units());
+ temp = hresolution;
}
}
else
@@ -1452,12 +1452,12 @@ void line_length()
void title_length()
{
hunits temp;
- hunits minimum_length = font::hor;
if (has_arg() && get_hunits(&temp, 'm', curenv->title_length)) {
- if (temp < minimum_length) {
- warning(WARN_RANGE, "invalid title length %1u rounded to device"
- " horizontal motion quantum", temp.to_units());
- temp = minimum_length;
+ if (temp < hresolution) {
+ warning(WARN_RANGE, "setting invalid title length %1u to device"
+ " horizontal motion quantum",
+ temp.to_units());
+ temp = hresolution;
}
}
else
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit