gbranden pushed a commit to branch master
in repository groff.

commit 8adc947262da60ae3e76eb745adf1490ede9ccf1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Dec 26 01:36:49 2025 -0600

    src/roff/troff/input.cpp: Bump type-correctness.
    
    * src/roff/troff/input.cpp (read_delimited_measurement): Make function
      definition agree with declaration; return object of type `units`
      rather than `int`.  (They're type-aliased with `typedef`, but
      scrupulous type correctness is more conceptually coherent and
      forecloses an avenue of future error.)
---
 ChangeLog                 | 8 ++++++++
 src/roff/troff/input.cpp  | 4 +++-
 src/roff/troff/number.cpp | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3c01a908f..577a2c6e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-12-26  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (read_delimited_measurement): Make
+       function definition agree with declaration; return object of
+       type `units` rather than `int`.  (They're type-aliased with
+       `typedef`, but scrupulous type correctness is more conceptually
+       coherent and forecloses an avenue of future error.)
+
 2025-12-25  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (read_input_until_terminator):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index fc12f7796..ed7893978 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6002,7 +6002,7 @@ static void interpolate_number_format(symbol nm)
 
 static bool read_delimited_measurement(units *n,
                                       unsigned char si,
-                                      int prev_value)
+                                      units prev_value)
 {
   token start_token;
   start_token.next();
@@ -6038,6 +6038,8 @@ static bool read_delimited_measurement(units *n,
   return false;
 }
 
+// TODO: Merge into other `read_delimited_measurement()`, using default
+// argument of 0 for `prev_value`.
 static bool read_delimited_measurement(units *n, unsigned char si)
 {
   token start_token;
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index ce70b671d..b08bc068c 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -158,6 +158,7 @@ bool read_hunits(hunits *res, unsigned char si, hunits 
prev_value)
   return true;
 }
 
+// TODO: Default `prev_value` to 0.
 bool read_measurement(units *res, unsigned char si, units prev_value)
 {
   units u;

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

Reply via email to