gbranden pushed a commit to branch master
in repository groff.

commit 91cc4985fb6cd8f57a3b150e7956b1545ba4388e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jun 11 10:19:40 2026 -0500

    [grohtml]: Migrate to ISO C++98 Boolean literals.
    
    * src/preproc/html/pushback.cpp: Drop preprocessor manipulations of
      `TRUE` and `FALSE` macros.
    
      (pushBackBuffer::pushBackBuffer, pushBackBuffer::getPB)
      (pushBackBuffer::isString): Use ISO C++98 Boolean literals.
    
      * src/preproc/html/pushback.h (class pushBackBuffer): Demote declared
        return type of `isString()` member function  from `int` to `bool`.
    
      * src/preproc/html/pushback.cpp
      (pushBackBuffer::getPB, pushBackBuffer::isString) (isDigit, isWhite,
      isHexDigit): Demote return type from `int` to `bool`.
    
    Continues the long process of fixing Savannah #66672.
---
 ChangeLog                     | 17 +++++++++++++++++
 src/preproc/html/pushback.cpp | 34 +++++++++++++---------------------
 src/preproc/html/pushback.h   |  2 +-
 3 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 323911be6..fc4226c6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2026-06-11  G. Branden Robinson <[email protected]>
+
+       * src/preproc/html/pushback.cpp: Migrate to ISO C++98 Boolean
+       literals.  Drop preprocessor manipulations of `TRUE` and `FALSE`
+       macros.
+       (pushBackBuffer::pushBackBuffer, pushBackBuffer::getPB)
+       (pushBackBuffer::isString): Use ISO C++98 Boolean literals.
+       * src/preproc/html/pushback.h (class pushBackBuffer): Demote
+       declared return type of `isString()` member function  from `int`
+       to `bool`.
+       * src/preproc/html/pushback.cpp
+       (pushBackBuffer::getPB, pushBackBuffer::isString)
+       (isDigit, isWhite, isHexDigit): Demote return type from `int` to
+       `bool`.
+
+       Continues the long process of fixing Savannah #66672.
+
 2026-06-11  G. Branden Robinson <[email protected]>
 
        * src/libs/libgroff/quotearg.c: Slightly refactor.  Favor C
diff --git a/src/preproc/html/pushback.cpp b/src/preproc/html/pushback.cpp
index 69b90001c..15f32dc8a 100644
--- a/src/preproc/html/pushback.cpp
+++ b/src/preproc/html/pushback.cpp
@@ -37,14 +37,6 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "pushback.h"
 #include "pre-html.h"
 
-#if !defined(TRUE)
-#   define TRUE  (1==1)
-#endif
-
-#if !defined(FALSE)
-#   define FALSE (1==0)
-#endif
-
 #   define ERROR(X)   (void)(fprintf(stderr, "%s:%d error %s\n", __FILE__, 
__LINE__, X) && \
                             (fflush(stderr)) && localexit(1))
 
@@ -64,7 +56,7 @@ pushBackBuffer::pushBackBuffer (const char *filename)
   }
   stackPtr = 0;   /* index to push back stack        */
   verbose  = 0;
-  eofFound = FALSE;
+  eofFound = false;
   lineNo   = 1;
   if (strcmp(filename, "") != 0) {
     stdIn = dup(0);
@@ -124,7 +116,7 @@ char pushBackBuffer::getPB (void)
       }
       return( ch );
     } else {
-      eofFound = TRUE;
+      eofFound = true;
       return( eof );
     }
   }
@@ -147,10 +139,10 @@ char pushBackBuffer::putPB (char ch)
 }
 
 /*
- *  isWhite - returns TRUE if a white character is found. This character is 
NOT consumed.
+ *  isWhite - returns true if a white character is found. This character is 
NOT consumed.
  */
 
-static int isWhite (char ch)
+static bool isWhite (char ch)
 {
   return( (ch==' ') || (ch == '\t') || (ch == '\n') );
 }
@@ -183,12 +175,12 @@ void pushBackBuffer::skipUntilToken (void)
 }
 
 /*
- *  isString - returns TRUE if the string, s, matches the pushed back string.
- *             if TRUE is returned then this string is consumed, otherwise it 
is
+ *  isString - returns true if the string, s, matches the pushed back string.
+ *             if true is returned then this string is consumed, otherwise it 
is
  *             left alone.
  */
 
-int pushBackBuffer::isString (const char *s)
+bool pushBackBuffer::isString (const char *s)
 {
   ptrdiff_t length=ptrdiff_t(strlen(s));
   ptrdiff_t i=0;
@@ -200,7 +192,7 @@ int pushBackBuffer::isString (const char *s)
     i++;
   }
   if (i==length) {
-    return( TRUE );
+    return( true );
   } else {
     i--;
     while (i>=0) {
@@ -210,24 +202,24 @@ int pushBackBuffer::isString (const char *s)
       i--;
     }
   }
-  return( FALSE );
+  return( false );
 }
 
 /*
- *  isDigit - returns TRUE if the character, ch, is a digit.
+ *  isDigit - returns true if the character, ch, is a digit.
  */
 
-static int isDigit (char ch)
+static bool isDigit (char ch)
 {
   return( ((ch>='0') && (ch<='9')) );
 }
 
 /*
- *  isHexDigit - returns TRUE if the character, ch, is a hex digit.
+ *  isHexDigit - returns true if the character, ch, is a hex digit.
  */
 
 #if 0
-static int isHexDigit (char ch)
+static bool isHexDigit (char ch)
 {
   return( (isDigit(ch)) || ((ch>='a') && (ch<='f')) );
 }
diff --git a/src/preproc/html/pushback.h b/src/preproc/html/pushback.h
index 2dbd49764..5386e6221 100644
--- a/src/preproc/html/pushback.h
+++ b/src/preproc/html/pushback.h
@@ -45,7 +45,7 @@ class pushBackBuffer
   double readNumber     (void);
   int    readInt        (void);
   char  *readString     (void);
-  int    isString       (const char *string);
+  bool   isString       (const char *string);
 };
 
 // Local Variables:

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

Reply via email to