gbranden pushed a commit to branch master
in repository groff.

commit 873b8c667a5a4421ffecf33116841f0372593853
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 15 17:44:09 2026 -0600

    [libgroff]: Slightly refactor; boolify.
    
    * src/include/searchpath.h (class search_path): Demote type of third
      constructor argument from `int` to `bool` in declaration.
    
    * src/libs/libgroff/searchpath.cpp: Likewise in the definition.  Rename
      argument from `add_current` to `add_current_working_directory` for
      clarity.
    
    * src/devices/grops/ps.cpp:
    * src/libs/libgroff/fontfile.cpp:
    * src/libs/libgroff/macropath.cpp:
    * src/preproc/html/pre-html.cpp:
    * src/preproc/soelim/soelim.cpp:
    * src/roff/troff/input.cpp: Update constructor callers to use Boolean
      rather than integer literals.
    
    Continues the long process of fixing Savannah #66672.
---
 ChangeLog                        | 19 +++++++++++++++++++
 src/devices/grops/ps.cpp         |  2 +-
 src/include/searchpath.h         |  3 +--
 src/libs/libgroff/fontfile.cpp   |  2 +-
 src/libs/libgroff/macropath.cpp  |  7 +++----
 src/libs/libgroff/searchpath.cpp |  6 +++---
 src/preproc/html/pre-html.cpp    |  2 +-
 src/preproc/soelim/soelim.cpp    |  2 +-
 src/roff/troff/input.cpp         |  2 +-
 9 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1b8d4f167..3c36ed66e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2026-11-15  G. Branden Robinson <[email protected]>
+
+       [libgroff]: Slightly refactor; boolify.
+
+       * src/include/searchpath.h (class search_path): Demote type of
+       third constructor argument from `int` to `bool` in declaration.
+       * src/libs/libgroff/searchpath.cpp: Likewise in the definition.
+       Rename argument from `add_current` to
+       `add_current_working_directory` for clarity.
+       * src/devices/grops/ps.cpp:
+       * src/libs/libgroff/fontfile.cpp:
+       * src/libs/libgroff/macropath.cpp:
+       * src/preproc/html/pre-html.cpp:
+       * src/preproc/soelim/soelim.cpp:
+       * src/roff/troff/input.cpp: Update constructor callers to use
+       Boolean rather than integer literals.
+
+       Continues the long process of fixing Savannah #66672.
+
 2026-11-15  G. Branden Robinson <[email protected]>
 
        * src/include/searchpath.h (class search_path): Fix code style
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 1133cf026..e733fe7ad 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -71,7 +71,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 extern "C" const char *Version_string;
 
 // Initialize inclusion search path with only the current directory.
-search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, 1);
+search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, true);
 
 static int landscape_flag = 0;
 static int manual_feed_flag = 0;
diff --git a/src/include/searchpath.h b/src/include/searchpath.h
index 427067196..3e1695cf4 100644
--- a/src/include/searchpath.h
+++ b/src/include/searchpath.h
@@ -21,9 +21,8 @@ class search_path {
   char *dirs;
   unsigned init_len; // TODO: size_t
 public:
-  // TODO: Boolify 3rd argument.
   search_path(const char * /* envvar */, const char * /* standard */,
-             int add_current);
+             bool);
   ~search_path();
   const char* contents() const;
   void command_line_dir(const char *);
diff --git a/src/libs/libgroff/fontfile.cpp b/src/libs/libgroff/fontfile.cpp
index 7d5851d7c..f1beea0d0 100644
--- a/src/libs/libgroff/fontfile.cpp
+++ b/src/libs/libgroff/fontfile.cpp
@@ -35,7 +35,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 // See groff(1), section "Environment".
 const char *const FONT_ENV_VAR = "GROFF_FONT_PATH";
 
-static search_path font_path(FONT_ENV_VAR, FONTPATH, 0);
+static search_path font_path(FONT_ENV_VAR, FONTPATH, false);
 
 int font::res = 0;
 int font::hor = 1;
diff --git a/src/libs/libgroff/macropath.cpp b/src/libs/libgroff/macropath.cpp
index 4e40c9227..b0834b486 100644
--- a/src/libs/libgroff/macropath.cpp
+++ b/src/libs/libgroff/macropath.cpp
@@ -29,10 +29,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #define MACROPATH_ENVVAR "GROFF_TMAC_PATH"
 
-// TODO: Boolify 3rd argument.
-search_path macro_path(MACROPATH_ENVVAR, MACROPATH, 1);
-search_path safer_macro_path(MACROPATH_ENVVAR, MACROPATH, 0);
-search_path config_macro_path(MACROPATH_ENVVAR, MACROPATH, 0);
+search_path macro_path(MACROPATH_ENVVAR, MACROPATH, true);
+search_path safer_macro_path(MACROPATH_ENVVAR, MACROPATH, false);
+search_path config_macro_path(MACROPATH_ENVVAR, MACROPATH, false);
 
 // Local Variables:
 // fill-column: 72
diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp
index 0782b8046..4b24bbf7a 100644
--- a/src/libs/libgroff/searchpath.cpp
+++ b/src/libs/libgroff/searchpath.cpp
@@ -53,14 +53,14 @@ static bool is_directory(const char *name)
 }
 
 search_path::search_path(const char *envvar, const char *standard,
-                        int add_current)
+                        bool add_current_working_directory)
 {
   char *home = 0 /* nullptr */;
   char *e = 0 /* nullptr */;
   if (envvar != 0 /* nullptr */)
     e = getenv(envvar);
   dirs = new char[((e && *e) ? strlen(e) + 1 : 0)
-                 + (add_current ? 1 + 1 : 0)
+                 + (add_current_working_directory ? 1 + 1 : 0)
                  + (((home != 0 /* nullptr */) && (*home != '\0'))
                     ? strlen(home) + 1 : 0)
                  + ((standard && *standard) ? strlen(standard) : 0)
@@ -70,7 +70,7 @@ search_path::search_path(const char *envvar, const char 
*standard,
     strcat(dirs, e);
     strcat(dirs, PATH_SEP);
   }
-  if (add_current) {
+  if (add_current_working_directory) {
     strcat(dirs, ".");
     strcat(dirs, PATH_SEP);
   }
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 7df7acbfe..6c496636e 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -238,7 +238,7 @@ static const char devhtml_desc[] = "devhtml/DESC";
 static const char devps_desc[] = "devps/DESC";
 
 const char *const FONT_ENV_VAR = "GROFF_FONT_PATH";
-static search_path font_path(FONT_ENV_VAR, FONTPATH, 0);
+static search_path font_path(FONT_ENV_VAR, FONTPATH, false);
 static html_dialect dialect = html4;
 
 
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 445e8c172..94a90cf66 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -40,7 +40,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 // Initialize inclusion search path with only the current directory.
 static search_path include_search_path(0 /* nullptr */, 0 /* nullptr */,
-                                      1);
+                                      true);
 
 bool want_att_compat = false;
 bool want_raw_output = false;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 539499192..cf3f71ac5 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -172,7 +172,7 @@ bool want_html_debugging = true;    // enable more 
diagnostics
 search_path *mac_path = &safer_macro_path;
 
 // Initialize inclusion search path with only the current directory.
-search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, 1);
+search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, true);
 
 static int read_character_in_copy_mode(node ** /* nd; 0 to discard */,
     bool /* is_defining_macro */ = false,

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

Reply via email to