gbranden pushed a commit to branch master
in repository groff.

commit ae9654ff0b677d506cb4dab0cf30047562e21c57
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 15 17:19:05 2026 -0600

    Drop unreachable code.
    
    ...and invariant function parameters.
    
    * src/include/searchpath.h (class search_path): Drop `add_home` flag
      from constructor declaration.
    
    * src/libs/libgroff/searchpath.cpp (search_path::search_path): Drop
      `add_home` flag from constructor definition.  Drop logic testing it.
    
    * 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 omit the
      now-removed third argument.  All used a value of `0`.
---
 ChangeLog                        | 17 +++++++++++++++++
 src/devices/grops/ps.cpp         |  2 +-
 src/include/searchpath.h         |  4 ++--
 src/libs/libgroff/fontfile.cpp   |  2 +-
 src/libs/libgroff/macropath.cpp  |  8 ++++----
 src/libs/libgroff/searchpath.cpp |  4 +---
 src/preproc/html/pre-html.cpp    |  2 +-
 src/preproc/soelim/soelim.cpp    |  2 +-
 src/roff/troff/input.cpp         |  2 +-
 9 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4afb9081b..2b5e90190 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2026-11-15  G. Branden Robinson <[email protected]>
+
+       Drop unreachable code and invariant function parameters.
+
+       * src/include/searchpath.h (class search_path): Drop `add_home`
+       flag from constructor declaration.
+       * src/libs/libgroff/searchpath.cpp (search_path::search_path):
+       Drop `add_home` flag from constructor definition.  Drop logic
+       testing it.
+       * 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 omit
+       the now-removed third argument.  All used a value of `0`.
+
 2026-11-15  G. Branden Robinson <[email protected]>
 
        * src/libs/libgroff/macropath.cpp: Drop inclusion of user's home
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index d4aa564c8..1133cf026 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 */, 0, 1);
+search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, 1);
 
 static int landscape_flag = 0;
 static int manual_feed_flag = 0;
diff --git a/src/include/searchpath.h b/src/include/searchpath.h
index 283aebd6a..b4685c8d5 100644
--- a/src/include/searchpath.h
+++ b/src/include/searchpath.h
@@ -21,9 +21,9 @@ class search_path {
   char *dirs;
   unsigned init_len; // TODO: size_t
 public:
-  // TODO: Boolify 3rd and 4th arguments.
+  // TODO: Boolify 3rd argument.
   search_path(const char *envvar, const char *standard,
-             int add_home, int add_current);
+             int add_current);
   ~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 148fd3be3..7d5851d7c 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, 0);
+static search_path font_path(FONT_ENV_VAR, FONTPATH, 0);
 
 int font::res = 0;
 int font::hor = 1;
diff --git a/src/libs/libgroff/macropath.cpp b/src/libs/libgroff/macropath.cpp
index ccb929dda..4e40c9227 100644
--- a/src/libs/libgroff/macropath.cpp
+++ b/src/libs/libgroff/macropath.cpp
@@ -29,10 +29,10 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #define MACROPATH_ENVVAR "GROFF_TMAC_PATH"
 
-// TODO: Boolify 3rd and 4th arguments.
-search_path macro_path(MACROPATH_ENVVAR, MACROPATH, 0, 1);
-search_path safer_macro_path(MACROPATH_ENVVAR, MACROPATH, 0, 0);
-search_path config_macro_path(MACROPATH_ENVVAR, MACROPATH, 0, 0);
+// 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);
 
 // Local Variables:
 // fill-column: 72
diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp
index 691ad7205..0782b8046 100644
--- a/src/libs/libgroff/searchpath.cpp
+++ b/src/libs/libgroff/searchpath.cpp
@@ -53,11 +53,9 @@ static bool is_directory(const char *name)
 }
 
 search_path::search_path(const char *envvar, const char *standard,
-                        int add_home, int add_current)
+                        int add_current)
 {
   char *home = 0 /* nullptr */;
-  if (add_home)
-    home = getenv("HOME");
   char *e = 0 /* nullptr */;
   if (envvar != 0 /* nullptr */)
     e = getenv(envvar);
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 79934db0d..7df7acbfe 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, 0);
+static search_path font_path(FONT_ENV_VAR, FONTPATH, 0);
 static html_dialect dialect = html4;
 
 
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index edd2109ab..445e8c172 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 */,
-                                      0, 1);
+                                      1);
 
 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 1c5254139..539499192 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 */, 0, 1);
+search_path include_search_path(0 /* nullptr */, 0 /* nullptr */, 1);
 
 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