gbranden pushed a commit to branch master
in repository groff.

commit c4615c862b07d037d36151b6013399b75df387cf
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Apr 9 22:53:51 2026 -0500

    src/roff/troff/number.cpp: Trivially refactor.
    
    ...for semantic clarity.
    
    * src/roff/troff/number.cpp (read_measurement_crement)
      (read_integer_crement): Rename the last argument from `prev_value` to
      `operand`.  Nothing in the implementation of these functions imparts a
      "previous value" meaning to that argument; that matter is
      context-dependent.
    
    Also discard annotation of future plan.  It no longer seems necessary to
    me, since at this time these functions have no callers that specify an
    explicit zero last argument.
---
 ChangeLog                 |  9 +++++++++
 src/roff/troff/number.cpp | 14 ++++++--------
 src/roff/troff/token.h    |  4 ++--
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 68a77e8f3..ae46e7388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-04-09  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/number.cpp (read_measurement_crement)
+       (read_integer_crement): Trivially refactor for semantic clarity.
+       Rename the last argument from `prev_value` to `operand`.
+       Nothing in the implementation of these functions imparts a
+       "previous value" meaning to that argument; that matter is
+       context-dependent.
+
 2026-04-09  G. Branden Robinson <[email protected]>
 
        [troff]: Trivially refactor for semantic clarity.  We had two
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index 93ab868f3..9a76d5a8e 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -182,10 +182,9 @@ bool read_hunits(hunits *res,
   return true;
 }
 
-// TODO: Default `prev_value` to 0.
 bool read_measurement_crement(units *res,
                              unsigned char si, // TODO: grochar
-                             units prev_value)
+                             units operand)
 {
   units u;
   switch (get_incr_number(&u, si)) {
@@ -195,11 +194,11 @@ bool read_measurement_crement(units *res,
     *res = u;
     break;
   case INCREMENT:
-    if (ckd_add(res, prev_value, u))
+    if (ckd_add(res, operand, u))
       warning(WARN_RANGE, "integer incrementation saturated");
     break;
   case DECREMENT:
-    if (ckd_sub(res, prev_value, u))
+    if (ckd_sub(res, operand, u))
       warning(WARN_RANGE, "integer decrementation saturated");
     break;
   default:
@@ -208,7 +207,7 @@ bool read_measurement_crement(units *res,
   return true;
 }
 
-bool read_integer_crement(int *res, int prev_value)
+bool read_integer_crement(int *res, int operand)
 {
   units i;
   switch (get_incr_number(&i, 0)) {
@@ -218,11 +217,11 @@ bool read_integer_crement(int *res, int prev_value)
     *res = i;
     break;
   case INCREMENT:
-    if (ckd_add(res, prev_value, i))
+    if (ckd_add(res, operand, i))
       warning(WARN_RANGE, "integer incrementation saturated");
     break;
   case DECREMENT:
-    if (ckd_sub(res, prev_value, i))
+    if (ckd_sub(res, operand, i))
       warning(WARN_RANGE, "integer decrementation saturated");
     break;
   default:
@@ -231,7 +230,6 @@ bool read_integer_crement(int *res, int prev_value)
   return true;
 }
 
-
 static incr_number_result get_incr_number(units *res,
                                          unsigned char si) // TODO: grochar
 {
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index 3fdbf4ba1..d07107890 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -155,9 +155,9 @@ extern bool read_integer(int *result);
 
 extern bool read_measurement_crement(units * /* result */,
                                     unsigned char /* si */, // TODO: grochar
-                                    units /* prev_value */);
+                                    units /* operand */);
 extern bool read_integer_crement(int * /* result */,
-                                int /* prev_value */);
+                                int /* operand */);
 
 extern void interpolate_register(symbol, int);
 

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

Reply via email to