gbranden pushed a commit to branch master
in repository groff.

commit da9c7c6e895765ea55d68bec11904da1cd4d36c6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 9 08:34:56 2025 -0600

    [refer]: Slightly refactor (boolify).
    
    * src/preproc/refer/token.h: Declare `get_token` as returning a `bool`
      rather than an `int`.
    
    * src/preproc/refer/token.cpp (get_token): Demote return type from `int`
      to `bool`.  Return Boolean, not integer, literals.
---
 ChangeLog                   | 9 +++++++++
 src/preproc/refer/token.cpp | 6 +++---
 src/preproc/refer/token.h   | 2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20e63ada3..2c6eb20e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-11-09  G. Branden Robinson <[email protected]>
+
+       [refer]: Slightly refactor (boolify).
+
+       * src/preproc/refer/token.h: Declare `get_token` as returning a
+       `bool` rather than an `int`.
+       * src/preproc/refer/token.cpp (get_token): Demote return type
+       from `int` to `bool`.  Return Boolean, not integer, literals.
+
 2025-11-09  G. Branden Robinson <[email protected]>
 
        * tmac/TODO: Rename this file...
diff --git a/src/preproc/refer/token.cpp b/src/preproc/refer/token.cpp
index 4f12bf7e9..56425764f 100644
--- a/src/preproc/refer/token.cpp
+++ b/src/preproc/refer/token.cpp
@@ -56,10 +56,10 @@ static void skip_name(const char **ptr, const char *end)
   }
 }
 
-int get_token(const char **ptr, const char *end)
+bool get_token(const char **ptr, const char *end)
 {
   if (*ptr >= end)
-    return 0;
+    return false;
   char c = *(*ptr)++;
   if (c == '\\' && *ptr < end) {
     switch (**ptr) {
@@ -77,7 +77,7 @@ int get_token(const char **ptr, const char *end)
       break;
     }
   }
-  return 1;
+  return true;
 }
 
 token_info::token_info()
diff --git a/src/preproc/refer/token.h b/src/preproc/refer/token.h
index 9cd688caf..146402387 100644
--- a/src/preproc/refer/token.h
+++ b/src/preproc/refer/token.h
@@ -83,5 +83,5 @@ inline int token_info::is_range_sep() const
   return type == TOKEN_RANGE_SEP;
 }
 
-int get_token(const char **ptr, const char *end);
+bool get_token(const char **ptr, const char *end);
 const token_info *lookup_token(const char *start, const char *end);

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

Reply via email to