gbranden pushed a commit to branch master
in repository groff.

commit 552211371680b946bd8d33aa6e6b3e4b32fabffe
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 14:11:53 2026 -0600

    [pic]: Boolify `get_location()` member functions.
    
    * src/preproc/pic/pic.h (class input)
      (class file_input):
    * src/preproc/pic/lex.cpp (class input_stack)
      (class simple_file_input):
    * src/preproc/pic/main.cpp (class top_input): Demote declaration of
      `get_location()` from `int` to `bool`.
    
    * src/preproc/pic/lex.cpp (input::get_location)
      (file_input::get_location)
      (input_stack::get_location)
      (simple_file_input::get_location):
    * src/preproc/pic/main.cpp (top_input::get_location): Return Boolean
      rather than integer literals.
    
    Continues the long process of fixing Savannah #66672.
---
 ChangeLog                | 19 +++++++++++++++++++
 src/preproc/pic/lex.cpp  | 22 +++++++++++-----------
 src/preproc/pic/main.cpp |  6 +++---
 src/preproc/pic/pic.h    |  4 ++--
 4 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ee20f2a6d..c461d2142 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2026-11-16  G. Branden Robinson <[email protected]>
+
+       [pic]: Boolify `get_location()` member functions.
+
+       * src/preproc/pic/pic.h (class input)
+       (class file_input):
+       * src/preproc/pic/lex.cpp (class input_stack)
+       (class simple_file_input):
+       * src/preproc/pic/main.cpp (class top_input): Demote declaration
+       of `get_location()` from `int` to `bool`.
+       * src/preproc/pic/lex.cpp (input::get_location)
+       (file_input::get_location)
+       (input_stack::get_location)
+       (simple_file_input::get_location):
+       * src/preproc/pic/main.cpp (top_input::get_location): Return
+       Boolean rather than integer literals.
+
+       Continues the long process of fixing Savannah #66672.
+
 2026-11-16  G. Branden Robinson <[email protected]>
 
        [pic]: Migrate to strdup(3).
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index be46829b7..ed11cd082 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -79,9 +79,9 @@ input::~input()
 {
 }
 
-int input::get_location(const char **, int *)
+bool input::get_location(const char **, int *)
 {
-  return 0;
+  return false;
 }
 
 file_input::file_input(FILE *f, const char *fn)
@@ -145,11 +145,11 @@ int file_input::peek()
     return EOF;
 }
 
-int file_input::get_location(const char **fnp, int *lnp)
+bool file_input::get_location(const char **fnp, int *lnp)
 {
   *fnp = filename;
   *lnp = lineno;
-  return 1;
+  return true;
 }
 
 macro_input::macro_input(const char *str)
@@ -278,7 +278,7 @@ public:
   static void clear();
   static int get_char();
   static int peek_char();
-  static int get_location(const char **fnp, int *lnp);
+  static bool get_location(const char **, int *);
   static void push_back(unsigned char c, int was_bol = 0);
   static int bol();
 };
@@ -382,12 +382,12 @@ void input_stack::push_back(unsigned char c, int was_bol)
   bol_flag = was_bol;
 }
 
-int input_stack::get_location(const char **fnp, int *lnp)
+bool input_stack::get_location(const char **fnp, int *lnp)
 {
   for (input *p = current_input; p; p = p->next)
     if (p->get_location(fnp, lnp))
-      return 1;
-  return 0;
+      return true;
+  return false;
 }
 
 string context_buffer;
@@ -1748,7 +1748,7 @@ public:
   ~simple_file_input();
   int get();
   int peek();
-  int get_location(const char **, int *);
+  bool get_location(const char **, int *);
 };
 
 simple_file_input::simple_file_input(FILE *p, const char *s)
@@ -1786,11 +1786,11 @@ int simple_file_input::peek()
   return c;
 }
 
-int simple_file_input::get_location(const char **fnp, int *lnp)
+bool simple_file_input::get_location(const char **fnp, int *lnp)
 {
   *fnp = filename;
   *lnp = lineno;
-  return 1;
+  return true;
 }
 
 
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 67be5ec47..f128909d8 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -73,7 +73,7 @@ public:
   top_input(FILE *);
   int get();
   int peek();
-  int get_location(const char **, int *);
+  bool get_location(const char **, int *);
 };
 
 top_input::top_input(FILE *p) : fp(p), bol(1), eof(0)
@@ -223,11 +223,11 @@ int top_input::peek()
   return c;
 }
 
-int top_input::get_location(const char **filenamep, int *linenop)
+bool top_input::get_location(const char **filenamep, int *linenop)
 {
   *filenamep = current_filename;
   *linenop = current_lineno;
-  return 1;
+  return true;
 }
 
 static void do_picture(FILE *fp)
diff --git a/src/preproc/pic/pic.h b/src/preproc/pic/pic.h
index aa77e49db..2bb1a6d8f 100644
--- a/src/preproc/pic/pic.h
+++ b/src/preproc/pic/pic.h
@@ -55,7 +55,7 @@ public:
   virtual ~input();
   virtual int get() = 0;
   virtual int peek() = 0;
-  virtual int get_location(const char **, int *);
+  virtual bool get_location(const char **, int *);
   friend class input_stack;
   friend class copy_rest_thru_input;
 };
@@ -72,7 +72,7 @@ public:
   ~file_input();
   int get();
   int peek();
-  int get_location(const char **, int *);
+  bool get_location(const char **, int *);
 };
 
 void lex_init(input *);

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

Reply via email to