gbranden pushed a commit to branch master
in repository groff.

commit d924ff811d28b9572d4e97446a2cfd6eb1d6ce0d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Mar 15 18:31:29 2026 -0500

    src/roff/groff/groff.cpp: Slightly refactor.
    
    * src/roff/groff/groff.cpp (main): Rename local variable `f` to
      `newpath` to make its purpose clearer.  Reduce number of string
      operations.
---
 ChangeLog                |  6 ++++++
 src/roff/groff/groff.cpp | 16 +++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 526627413..a74b03adb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-03-15  G. Branden Robinson <[email protected]>
+
+       * src/roff/groff/groff.cpp (main): Slightly refactor.  Rename
+       local variable `f` to `newpath` to make its purpose clearer.
+       Reduce number of string operations.
+
 2026-03-15  G. Branden Robinson <[email protected]>
 
        * src/devices/xditview/device.c (find_file): Initialize local
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index a5a5190fe..9317e1c9e 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -545,20 +545,18 @@ int main(int argc, char **argv)
     saved_path = xstrdup(g.contents());
     xputenv(saved_path);
     char *binpath = getenv("GROFF_BIN_PATH");
-    string f = "PATH";
-    f += '=';
+    string newpath = "PATH=";
     if ((binpath != 0 /* nullptr */ && (*binpath != '\0')))
-      f += binpath;
+      newpath += binpath;
     else {
-      binpath = relocatep(BINPATH);
-      f += binpath;
+      newpath += relocatep(BINPATH);
     }
     if ((path != 0 /* nullptr */ && (*path != '\0'))) {
-      f += PATH_SEP_CHAR;
-      f += path;
+      newpath += PATH_SEP_CHAR;
+      newpath += path;
     }
-    f += '\0';
-    groff_bin_path = xstrdup(f.contents());
+    newpath += '\0';
+    groff_bin_path = xstrdup(newpath.contents());
     xputenv(groff_bin_path);
   }
   if (Vflag)

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

Reply via email to