gbranden pushed a commit to branch master
in repository groff.

commit 79b13e8d407cacefdd6cb9bc62250b635c33f5f9
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Thu Jul 10 15:49:32 2025 -0500

    Trivially refactor (`lf` request helpers 1/2).
    
    [libgroff, eqn, pic, preconv, refer, soelim, tbl]: Rename
    `normalize_for_lf()` library function to
    `normalize_file_name_for_lf_request()` so that its purpose and argument
    are obvious.
    
    * src/include/lf.h:
    * src/libs/libgroff/lf.cpp: Rename it.
    
    * src/preproc/eqn/main.cpp (main):
    * src/preproc/pic/main.cpp (main):
    * src/preproc/preconv/preconv.cpp (do_file):
    * src/preproc/refer/refer.cpp (do_file):
    * src/preproc/soelim/soelim.cpp (do_file):
    * src/preproc/tbl/main.cpp (main):
    * src/preproc/tbl/table.cpp (set_troff_location): Update call sites.
---
 ChangeLog                       | 19 +++++++++++++++++++
 src/include/lf.h                |  4 ++--
 src/libs/libgroff/lf.cpp        |  6 +++---
 src/preproc/eqn/main.cpp        |  2 +-
 src/preproc/pic/main.cpp        |  4 ++--
 src/preproc/preconv/preconv.cpp |  2 +-
 src/preproc/refer/refer.cpp     |  2 +-
 src/preproc/soelim/soelim.cpp   |  2 +-
 src/preproc/tbl/main.cpp        |  2 +-
 src/preproc/tbl/table.cpp       |  2 +-
 10 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 711afa5e3..56c72571f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2025-07-10  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       [libgroff, eqn, pic, preconv, refer, soelim, tbl]: Trivially
+       refactor.  Rename `normalize_for_lf()` library function to
+       `normalize_file_name_for_lf_request()` so that its purpose and
+       argument are obvious.
+
+       * src/include/lf.h:
+       * src/libs/libgroff/lf.cpp: Rename it.
+
+       * src/preproc/eqn/main.cpp (main):
+       * src/preproc/pic/main.cpp (main):
+       * src/preproc/preconv/preconv.cpp (do_file):
+       * src/preproc/refer/refer.cpp (do_file):
+       * src/preproc/soelim/soelim.cpp (do_file):
+       * src/preproc/tbl/main.cpp (main):
+       * src/preproc/tbl/table.cpp (set_troff_location): Update call
+       sites.
+
 2025-07-10  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/libs/libgroff/font.cpp (text_file::next_line): Handle
diff --git a/src/include/lf.h b/src/include/lf.h
index 1ed034554..b4917a752 100644
--- a/src/include/lf.h
+++ b/src/include/lf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2014-2025 Free Software Foundation, Inc.
      Written by Werner Lemberg (w...@gnu.org)
 
 This file is part of groff.
@@ -19,7 +19,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "stringclass.h"
 
 bool interpret_lf_args(const char *p);
-void normalize_for_lf (string &fn);
+void normalize_file_name_for_lf_request(string &fn);
 
 // Local Variables:
 // fill-column: 72
diff --git a/src/libs/libgroff/lf.cpp b/src/libs/libgroff/lf.cpp
index 766e4c3a2..0520c28bc 100644
--- a/src/libs/libgroff/lf.cpp
+++ b/src/libs/libgroff/lf.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
      Written by James Clark (j...@jclark.com)
 
 This file is part of groff.
@@ -67,7 +67,7 @@ bool interpret_lf_args(const char *p)
 }
 
 #if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN__))
-void normalize_for_lf (string &fn)
+void normalize_file_name_for_lf_request(string &fn)
 {
   int fnlen = fn.length();
   for (int i = 0; i < fnlen; i++) {
@@ -76,7 +76,7 @@ void normalize_for_lf (string &fn)
   }
 }
 #else
-void normalize_for_lf (string &)
+void normalize_file_name_for_lf_request(string &)
 {
 }
 #endif
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index e93ee4dd1..29d9e83b4 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -99,7 +99,7 @@ void do_file(FILE *fp, const char *filename)
   string str;
   string fn(filename);
   fn += '\0';
-  normalize_for_lf(fn);
+  normalize_file_name_for_lf_request(fn);
   current_lineno = 1;
   current_filename = fn.contents();
   if (output_format == troff)
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 4bb7d752d..6e60e3002 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
      Written by James Clark (j...@jclark.com)
 
 This file is part of groff.
@@ -330,7 +330,7 @@ void do_file(const char *filename)
   }
   string fn(filename);
   fn += '\0';
-  normalize_for_lf(fn);
+  normalize_file_name_for_lf_request(fn);
   current_filename = fn.contents();
   out->set_location(current_filename, 1);
   current_lineno = 1;
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index c81ddbc6d..30531078b 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -1195,7 +1195,7 @@ do_file(const char *filename)
   if (!raw_flag) {
     string fn(filename);
     fn += '\0';
-    normalize_for_lf(fn);
+    normalize_file_name_for_lf_request(fn);
     (void) printf(".lf 1 %s%s\n", ('"' == filename[0]) ? "" : "\"",
                  fn.contents());
   }
diff --git a/src/preproc/refer/refer.cpp b/src/preproc/refer/refer.cpp
index 66eeda84f..be414fc82 100644
--- a/src/preproc/refer/refer.cpp
+++ b/src/preproc/refer/refer.cpp
@@ -472,7 +472,7 @@ static void do_file(const char *filename)
   }
   string fn(filename);
   fn += '\0';
-  normalize_for_lf(fn);
+  normalize_file_name_for_lf_request(fn);
   current_lineno = 1;
   current_filename = fn.contents();
   (void) fprintf(outfp, ".lf %d %s%s\n", current_lineno,
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 1f66cc395..04b0bd65e 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -198,7 +198,7 @@ int do_file(const char *filename)
          strerror(err));
     return 0;
   }
-  normalize_for_lf(whole_filename);
+  normalize_file_name_for_lf_request(whole_filename);
   current_filename = whole_filename.contents();
   current_lineno = 1;
   set_location();
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 00c37fb71..614a322f5 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -1723,7 +1723,7 @@ int main(int argc, char **argv)
        else {
          string fn(argv[i]);
          fn += '\0';
-         normalize_for_lf(fn);
+         normalize_file_name_for_lf_request(fn);
          current_lineno = 1;
          current_filename = fn.contents();
          (void) printf(".lf %d %s%s\n", current_lineno,
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 5c7ee13fb..af20d8686 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -3207,7 +3207,7 @@ void set_troff_location(const char *fn, int ln)
   else {
     string filename(fn);
     filename += '\0';
-    normalize_for_lf(filename);
+    normalize_file_name_for_lf_request(filename);
     printfs(".lf %1 %2%3\n", as_string(ln),
            ('"' == filename[0]) ? "" : "\"", filename.contents());
 

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to