gbranden pushed a commit to branch master
in repository groff.

commit 34cafd17a2c009293434c98649965ee02f167b23
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Dec 29 06:14:07 2025 -0600

    [troff]: Improve type-correctness (slightly).
    
    * src/roff/troff/number.cpp: Define globals `hresolution`,
      `vresolution`, and `units_per_inch` as having `units` type rather than
      `int`.  This is merely _documentary_ type-correctness, however, as
      `units` isn't truly typed, but merely a slovenly `typedef` alias of
      `int`.
    
    * src/roff/troff/troff.h: Align declarations with foregoing definitions.
---
 ChangeLog                 | 12 ++++++++++++
 src/roff/troff/number.cpp |  6 +++---
 src/roff/troff/troff.h    |  8 ++++----
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 559b5ce3c..69de40c2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-12-29  G. Branden Robinson <[email protected]>
+
+       [troff]: Improve type-correctness (slightly).
+
+       * src/roff/troff/number.cpp: Define globals `hresolution`,
+       `vresolution`, and `units_per_inch` as having `units` type
+       rather than `int`.  This is merely _documentary_
+       type-correctness, however, as `units` isn't strongly typed, but
+       merely a slovenly `typedef` alias of `int`.
+       * src/roff/troff/troff.h: Align declarations with foregoing
+       definitions.
+
 2025-12-29  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp: Fix code style nits.
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index b08bc068c..0cc58dbc9 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -34,9 +34,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 const vunits V0; // zero in vertical units
 const hunits H0; // zero in horizontal units
 
-int hresolution = 1;
-int vresolution = 1;
-int units_per_inch;
+units hresolution = 1;
+units vresolution = 1;
+units units_per_inch;
 int sizescale; // subdivisions per point
 
 static bool is_valid_expression(units *u, int scaling_unit,
diff --git a/src/roff/troff/troff.h b/src/roff/troff/troff.h
index a6c20c3e9..abcc33656 100644
--- a/src/roff/troff/troff.h
+++ b/src/roff/troff/troff.h
@@ -26,8 +26,6 @@ typedef int units;
 
 extern units scale(units n, units x, units y); // scale n by x/y
 
-extern units units_per_inch;
-
 extern bool want_abstract_output;
 extern bool want_output_suppressed;
 extern bool want_color_output;
@@ -35,8 +33,10 @@ extern bool is_writing_html;
 extern bool in_nroff_mode;
 
 extern bool device_has_tcommand;
-extern int vresolution;
-extern int hresolution;
+
+extern units hresolution;
+extern units vresolution;
+extern units units_per_inch;
 extern int sizescale;
 
 extern search_path *mac_path;

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to